# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 62
n 62(None)[return ret
]:
	i: 3(), 26(), 60(AE)
	o: 

nname: 60
n 60(None)[]:
	i: 16(f)
	o: 62(AE)

nname: 26
n 26(None)[#, e
log.error('dbus error while calling %s: %s', m, e)
ret = None
]:
	i: 16(t)
	o: 62()

nname: 16
n 16(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 0(except)
	o: 26(t), 60(f)

nname: 3
n 3(None)[ret = m()
]:
	i: 0(try)
	o: 62()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 16(except)

nname: 16
n 16(None)[except Exception, e:
	log.error('dbus error while calling %s: %s', m, e)
	ret = None
return ret
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	ret = m()
]:
	i: 
	o: 16()

nname: 0
n 0(None)[try:
	ret = m()
except Exception, e:
	log.error('dbus error while calling %s: %s', m, e)
	ret = None
return ret
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b6ec>}
nname: 127
n 127(None)[return ''.join(result)
]:
	i: 0(AL), 126()
	o: 

nname: 126
n 126(None)[]:
	i: 9(AF), 97()
	o: 127()

nname: 97
n 97(None)[del _[1]
result.append('%s' % hexa)
]:
	i: 34(AF), 74()
	o: 126()

nname: 74
n 74(None)[for x in s:
]:
	i: 34(for)
	o: 97()

nname: 34
n 34(None)[for i in xrange(0, len(src), length):
s = src[i:i + length]
]:
	i: 9(for)
	o: 74(for), 97(AF)

nname: 9
n 9(None)[]:
	i: 0(loop)
	o: 34(for), 126(AF)

nname: 0
n 0(None)[result = []
]:
	i: 
	o: 9(loop), 127(AL)

nname: 127
n 127(None)[return ''.join(result)
]:
	i: 0(AL), 9(AF), 97()
	o: 

nname: 97
n 97(None)[del _[1]
result.append('%s' % hexa)
]:
	i: 34(AF), 74()
	o: 127()

nname: 74
n 74(None)[for x in s:
]:
	i: 34(for)
	o: 97()

nname: 34
n 34(None)[for i in xrange(0, len(src), length):
s = src[i:i + length]
]:
	i: 9(for)
	o: 74(for), 97(AF)

nname: 9
n 9(None)[]:
	i: 0(loop)
	o: 34(for), 127(AF)

nname: 0
n 0(None)[result = []
]:
	i: 
	o: 9(loop), 127(AL)

self.nodes: {0: <unpyclib.structure.node instance at 0xb764bfcc>, 97: <unpyclib.structure.node instance at 0xb764b26c>, 34: <unpyclib.structure.node instance at 0xb764bf6c>, 9: <unpyclib.structure.node instance at 0xb764beec>, 74: <unpyclib.structure.node instance at 0xb764bfec>, 127: <unpyclib.structure.node instance at 0xb764b2cc>}
nname: 0
n 0(None)[from peewee.dbus import peewee_dbus
self._pynet = None
self._wdb = peewee_dbus
self._nm = self._wdb.reference(dbus_service, '/org/freedesktop/NetworkManager', 'org.freedesktop.NetworkManager')
self._nm_sig = self._wdb.instance('/org/freedesktop/NetworkManager')
self._getDevices = self._nm.method('getDevices', '', 'ao')
self._state = self._nm.method('state', '', 'i')
self._setActiveEthDevice = self._nm.method('setActiveDevice', 'o', '')
self._setActiveWlanDevice = self._nm.method('setActiveDevice', 'os', '')
self._setActiveWepDevice = self._nm.method('setActiveDevice', 'osisi', '')
self._setActiveWpaDevice = self._nm.method('setActiveDevice', 'osisii', '')
self._obs = []
self._nm_sig.signal('DeviceAdded', 'os', self.device_added, 0)
self._nm_sig.signal('DeviceNowActive', 'os', self.wireless_now_active, 0)
self._nm_sig.signal('DeviceActivationFailed', 'os', self.device_activation_failed, 0)
self._nm_sig.signal('WirelessNetworkAppeared', 'oo', self.wireless_network_appeared, 0)
self._nm_sig.signal('WirelessNetworkDisappeared', 'oo', self.wireless_network_disappeared, 0)
self.get_wireless_configuration = partial(self.get_configuration_by_name, 'Wireless')
self.get_wired_configuration = partial(self.get_configuration_by_name, 'Ethernet')
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76466ac>}
nname: 65
n 65(None)[return self._pynet
]:
	i: 13(JA), 32(JA), 61(), 64()
	o: 

nname: 64
n 64(None)[]:
	i: 0(t)
	o: 65()

nname: 32
n 32(None)[log.warn('Unable to contect wynetwork')
self._pynet = None
]:
	i: 9(except)
	o: 65(JA)

nname: 13
n 13(None)[self._pynet = pynetwork.WyNetworkModule_instance()
]:
	i: 9(try)
	o: 65(JA)

nname: 9
n 9(None)[]:
	i: 0(f)
	o: 13(try), 32(except)

nname: 0
n 0(self._pynet)[]:
	i: 
	o: 9(f), 64(t)

nname: 65
n 65(None)[return self._pynet
]:
	i: 32(JA), 61(), 0(t)
	o: 

nname: 32
n 32(None)[except:
	log.warn('Unable to contect wynetwork')
	self._pynet = None
]:
	i: 9()
	o: 65(JA)

nname: 9
n 9(None)[try:
	self._pynet = pynetwork.WyNetworkModule_instance()
]:
	i: 0(f)
	o: 32()

nname: 0
n 0(self._pynet)[]:
	i: 
	o: 9(f), 65(t)

nname: 65
n 65(None)[return self._pynet
]:
	i: 9(JA), 61(), 0(t)
	o: 

nname: 9
n 9(None)[try:
	self._pynet = pynetwork.WyNetworkModule_instance()
except:
	log.warn('Unable to contect wynetwork')
	self._pynet = None
]:
	i: 0(f)
	o: 65(JA)

nname: 0
n 0(self._pynet)[]:
	i: 
	o: 9(f), 65(t)

nname: 65
n 65(None)[return self._pynet
]:
	i: 61(), 0(t)
	o: 

nname: 0
n 0(None)[if not self._pynet:
	try:
		self._pynet = pynetwork.WyNetworkModule_instance()
	except:
		log.warn('Unable to contect wynetwork')
		self._pynet = None
]:
	i: 
	o: 65(JA)

self.nodes: {0: <unpyclib.structure.node instance at 0xb7644aac>, 65: <unpyclib.structure.node instance at 0xb764490c>, 60: <unpyclib.structure.node instance at 0xb764482c>, 61: <unpyclib.structure.node instance at 0xb764486c>}
nname: 0
n 0(None)[self._obs.append(obs)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764456c>}
nname: 0
n 0(None)[self._obs.remove(obj)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764458c>}
nname: 270
n 270(None)[return hwaddr
]:
	i: 171(AL), 269()
	o: 

nname: 269
n 269(None)[]:
	i: 212(AF), 265()
	o: 270()

nname: 265
n 265(None)[]:
	i: 219(f), 237()
	o: 269()

nname: 237
n 237(None)[continue
]:
	i: 219(t)
	o: 265()

nname: 219
n 219(line.startswith('HWaddr'))[for line in fields:
]:
	i: 212(for)
	o: 237(t), 265(f)

nname: 212
n 212(None)[]:
	i: 171(loop)
	o: 219(for), 269(AF)

nname: 171
n 171(None)[]:
	i: 150(), 170()
	o: 212(loop), 270(AL)

nname: 170
n 170(None)[]:
	i: 138(t)
	o: 171()

nname: 150
n 150(None)[raise ValueError('The interface %s does not exist' % interface)
]:
	i: 138(f)
	o: 171()

nname: 138
n 138(data)[del _[1]
for data in raw.split('\n\n'):
]:
	i: 78(AF), 134()
	o: 150(f), 170(t)

nname: 134
n 134(None)[]:
	i: 101(f), 123()
	o: 138()

nname: 123
n 123(None)[continue
]:
	i: 101(t)
	o: 134()

nname: 101
n 101(line.startswith(interface + ' '))[for line in raw.split('\n\n'):
]:
	i: 78(for)
	o: 123(t), 134(f)

nname: 78
n 78(None)[]:
	i: 69(), 77()
	o: 101(for), 138(AF)

nname: 77
n 77(None)[]:
	i: 0(f)
	o: 78()

nname: 69
n 69(None)[return '00:00:00:00:00:00'
]:
	i: 0(t)
	o: 78()

nname: 0
n 0(interface is None)[ifconfig = os.popen('/sbin/ifconfig')
raw = ifconfig.read()
ifconfig.close()
interface = self.get_active_configuration()['values']['interface']
]:
	i: 
	o: 69(t), 77(f)

nname: 270
n 270(None)[return hwaddr
]:
	i: 138(AL), 212(AF), 219()
	o: 

nname: 219
n 219(None)[for line in fields:
if line.startswith('HWaddr'):
	continue
]:
	i: 212(for)
	o: 270()

nname: 212
n 212(None)[]:
	i: 138(loop)
	o: 219(for), 270(AF)

nname: 138
n 138(None)[del _[1]
for data in raw.split('\n\n'):
if not data:
	raise ValueError('The interface %s does not exist' % interface)
]:
	i: 0(AF), 101()
	o: 212(loop), 270(AL)

nname: 101
n 101(None)[for line in raw.split('\n\n'):
if line.startswith(interface + ' '):
	continue
]:
	i: 0(for)
	o: 138()

nname: 0
n 0(None)[ifconfig = os.popen('/sbin/ifconfig')
raw = ifconfig.read()
ifconfig.close()
interface = self.get_active_configuration()['values']['interface']
if interface is None:
	return '00:00:00:00:00:00'
]:
	i: 
	o: 101(for), 138(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb76462cc>, 219: <unpyclib.structure.node instance at 0xb764654c>, 101: <unpyclib.structure.node instance at 0xb764630c>, 138: <unpyclib.structure.node instance at 0xb76463cc>, 212: <unpyclib.structure.node instance at 0xb76465cc>, 270: <unpyclib.structure.node instance at 0xb764690c>}
nname: 158
n 158(None)[return servers
]:
	i: 123(), 137(), 156(AE)
	o: 

nname: 156
n 156(None)[]:
	i: 127(f)
	o: 158(AE)

nname: 137
n 137(None)[servers = ['0.0.0.0', '0.0.0.0']
]:
	i: 127(t)
	o: 158()

nname: 127
n 127(<dummy_ex3> EXC_MATCH IOError)[]:
	i: 0(except)
	o: 137(t), 156(f)

nname: 123
n 123(None)[]:
	i: 106(), 122()
	o: 158()

nname: 122
n 122(None)[]:
	i: 84(t)
	o: 123()

nname: 106
n 106(None)[]:
	i: 84(f)
	o: 123()

nname: 84
n 84(servers)[del _[1]
for servers in resolv:
resolv.close()
]:
	i: 3(AF), 80()
	o: 106(f), 122(t)

nname: 80
n 80(None)[]:
	i: 29(f), 47()
	o: 84()

nname: 47
n 47(None)[continue
]:
	i: 29(t)
	o: 80()

nname: 29
n 29(line.startswith('nameserver'))[for line in resolv:
]:
	i: 3(for)
	o: 47(t), 80(f)

nname: 3
n 3(None)[resolv = open('/etc/resolv.conf')
]:
	i: 0(try)
	o: 29(for), 84(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 127(except)

nname: 158
n 158(None)[return servers
]:
	i: 84(), 127()
	o: 

nname: 127
n 127(None)[except IOError:
	servers = ['0.0.0.0', '0.0.0.0']
]:
	i: 0()
	o: 158()

nname: 84
n 84(None)[del _[1]
for servers in resolv:
resolv.close()
if not servers:
	pass
]:
	i: 0(AF), 29()
	o: 158()

nname: 29
n 29(None)[for line in resolv:
if line.startswith('nameserver'):
	continue
]:
	i: 0(for)
	o: 84()

nname: 0
n 0(None)[try:
	resolv = open('/etc/resolv.conf')
]:
	i: 
	o: 29(for), 84(AF), 127()

self.nodes: {0: <unpyclib.structure.node instance at 0xb7646d2c>, 84: <unpyclib.structure.node instance at 0xb764604c>, 29: <unpyclib.structure.node instance at 0xb75df0ac>, 158: <unpyclib.structure.node instance at 0xb7644f6c>, 127: <unpyclib.structure.node instance at 0xb7646b0c>}
nname: 503
n 503(None)[return {'ip': _ip, 'netmask': _netmask, 'hwaddr': _hwaddr, 'gateway': _gateway, 'dns1': dns_servs[0], 'dns2': dns_servs[1]}
]:
	i: 485(), 502()
	o: 

nname: 502
n 502(None)[]:
	i: 455(f)
	o: 503()

nname: 485
n 485(None)[dns_servs.append('0.0.0.0')
]:
	i: 455(t)
	o: 503()

nname: 455
n 455(len(dns_servs) == 1)[]:
	i: 418(), 454()
	o: 485(t), 502(f)

nname: 454
n 454(None)[]:
	i: 406(f)
	o: 455()

nname: 418
n 418(None)[]:
	i: 406(t)
	o: 455()

nname: 406
n 406(data)[del _[2]
for data in raw.split('\n'):
]:
	i: 297(AF), 402()
	o: 418(t), 454(f)

nname: 402
n 402(None)[]:
	i: 357&375(f), 391()
	o: 406()

nname: 391
n 391(None)[continue
]:
	i: 357&375(t)
	o: 402()

nname: 357&375
n 357&375(line.startswith('0.0.0.0 ') and line.endswith(ifname))[for line in raw.split('\n'):
]:
	i: 297(for)
	o: 391(t), 402(f)

nname: 297
n 297(None)[route.close()
]:
	i: 154(AL), 296()
	o: 357&375(for), 406(AF)

nname: 296
n 296(None)[]:
	i: 195(AF), 292()
	o: 297()

nname: 292
n 292(None)[]:
	i: 248(f), 264()
	o: 296()

nname: 264
n 264(None)[continue
]:
	i: 248(t)
	o: 292()

nname: 248
n 248(line.startswith('Mask'))[]:
	i: 202(f), 220()
	o: 264(t), 292(f)

nname: 220
n 220(None)[continue
]:
	i: 202(t)
	o: 248()

nname: 202
n 202(line.startswith('inet addr'))[for line in fields:
]:
	i: 195(for)
	o: 220(t), 248(f)

nname: 195
n 195(None)[]:
	i: 154(loop)
	o: 202(for), 296(AF)

nname: 154
n 154(None)[]:
	i: 133(), 153()
	o: 195(loop), 297(AL)

nname: 153
n 153(None)[]:
	i: 121(t)
	o: 154()

nname: 133
n 133(None)[raise ValueError('The interface %s does not exist' % ifname)
]:
	i: 121(f)
	o: 154()

nname: 121
n 121(data)[del _[1]
for data in raw.split('\n\n'):
]:
	i: 0(AF), 117()
	o: 133(f), 153(t)

nname: 117
n 117(None)[]:
	i: 84(f), 106()
	o: 121()

nname: 106
n 106(None)[continue
]:
	i: 84(t)
	o: 117()

nname: 84
n 84(line.startswith(ifname + ' '))[for line in raw.split('\n\n'):
]:
	i: 0(for)
	o: 106(t), 117(f)

nname: 0
n 0(None)[_ip = '0.0.0.0'
_hwaddr = '00:00:00:00:00:00'
_netmask = '0.0.0.0'
_gateway = '0.0.0.0'
ifconfig = os.popen('/sbin/ifconfig')
raw = ifconfig.read()
ifconfig.close()
]:
	i: 
	o: 84(for), 121(AF)

nname: 503
n 503(None)[return {'ip': _ip, 'netmask': _netmask, 'hwaddr': _hwaddr, 'gateway': _gateway, 'dns1': dns_servs[0], 'dns2': dns_servs[1]}
]:
	i: 406()
	o: 

nname: 406
n 406(None)[del _[2]
for data in raw.split('\n'):
if data:
	pass
if len(dns_servs) == 1:
	dns_servs.append('0.0.0.0')
]:
	i: 297(AF), 357&375(f)
	o: 503()

nname: 357&375
n 357&375(None)[for line in raw.split('\n'):
if line.startswith('0.0.0.0 ') and line.endswith(ifname):
	continue
]:
	i: 297(for)
	o: 406()

nname: 297
n 297(None)[route.close()
]:
	i: 121(AL), 195(AF), 202(f)
	o: 357&375(for), 406(AF)

nname: 202
n 202(None)[for line in fields:
if line.startswith('inet addr'):
	continue
if line.startswith('Mask'):
	continue
]:
	i: 195(for)
	o: 297()

nname: 195
n 195(None)[]:
	i: 121(loop)
	o: 202(for), 297(AF)

nname: 121
n 121(None)[del _[1]
for data in raw.split('\n\n'):
if not data:
	raise ValueError('The interface %s does not exist' % ifname)
]:
	i: 0(AF), 84()
	o: 195(loop), 297(AL)

nname: 84
n 84(None)[for line in raw.split('\n\n'):
if line.startswith(ifname + ' '):
	continue
]:
	i: 0(for)
	o: 121()

nname: 0
n 0(None)[_ip = '0.0.0.0'
_hwaddr = '00:00:00:00:00:00'
_netmask = '0.0.0.0'
_gateway = '0.0.0.0'
ifconfig = os.popen('/sbin/ifconfig')
raw = ifconfig.read()
ifconfig.close()
]:
	i: 
	o: 84(for), 121(AF)

nname: 406
n 406(None)[del _[2]
for data in raw.split('\n'):
if data:
	pass
if len(dns_servs) == 1:
	dns_servs.append('0.0.0.0')
return {'ip': _ip, 'netmask': _netmask, 'hwaddr': _hwaddr, 'gateway': _gateway, 'dns1': dns_servs[0], 'dns2': dns_servs[1]}
]:
	i: 297(AF), 357&375(f)
	o: 

nname: 357&375
n 357&375(None)[for line in raw.split('\n'):
if line.startswith('0.0.0.0 ') and line.endswith(ifname):
	continue
]:
	i: 297(for)
	o: 406()

nname: 297
n 297(None)[route.close()
]:
	i: 121(AL), 195(AF), 202(f)
	o: 357&375(for), 406(AF)

nname: 202
n 202(None)[for line in fields:
if line.startswith('inet addr'):
	continue
if line.startswith('Mask'):
	continue
]:
	i: 195(for)
	o: 297()

nname: 195
n 195(None)[]:
	i: 121(loop)
	o: 202(for), 297(AF)

nname: 121
n 121(None)[del _[1]
for data in raw.split('\n\n'):
if not data:
	raise ValueError('The interface %s does not exist' % ifname)
]:
	i: 0(AF), 84()
	o: 195(loop), 297(AL)

nname: 84
n 84(None)[for line in raw.split('\n\n'):
if line.startswith(ifname + ' '):
	continue
]:
	i: 0(for)
	o: 121()

nname: 0
n 0(None)[_ip = '0.0.0.0'
_hwaddr = '00:00:00:00:00:00'
_netmask = '0.0.0.0'
_gateway = '0.0.0.0'
ifconfig = os.popen('/sbin/ifconfig')
raw = ifconfig.read()
ifconfig.close()
]:
	i: 
	o: 84(for), 121(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75e6acc>, 406: <unpyclib.structure.node instance at 0xb75e6c4c>, 297: <unpyclib.structure.node instance at 0xb75e6d0c>, 195: <unpyclib.structure.node instance at 0xb75e69cc>, 202: <unpyclib.structure.node instance at 0xb75e666c>, 84: <unpyclib.structure.node instance at 0xb75e68cc>, '357&375': <unpyclib.structure.node instance at 0xb75e6f4c>, 121: <unpyclib.structure.node instance at 0xb75e682c>}
nname: 234
n 234(None)[return {'config': None, 'values': dict(<genexpr>(PY_RANK_PARAMS))}
]:
	i: 216(), 220(), 233(AE)
	o: 

nname: 220
n 220(None)[PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 234()

nname: 216
n 216(None)[]:
	i: 3(AL), 215()
	o: 234()

nname: 215
n 215(None)[]:
	i: 6(AF), 211()
	o: 216()

nname: 211
n 211(None)[]:
	i: 22(f), 164()
	o: 215()

nname: 164
n 164(None)[return {'config': config, 'values': dict(<genexpr>(PY_RANK_PARAMS))}
continue
]:
	i: 70(), 163()
	o: 211()

nname: 163
n 163(None)[]:
	i: 53(f)
	o: 164()

nname: 70
n 70(None)[infos = self._get_network_infos(params[1])
params[4] = infos['ip']
params[5] = infos['netmask']
params[6] = infos['gateway']
params[7] = infos['dns1']
params[8] = infos['dns2']
]:
	i: 53(t)
	o: 164()

nname: 53
n 53(params[3] == 'upnp')[]:
	i: 22(t)
	o: 70(t), 163(f)

nname: 22
n 22(params[0])[for config in self.pynet.getConfigurations():
params = self.pynet.getConfiguration(config)
]:
	i: 6(for)
	o: 53(t), 211(f)

nname: 6
n 6(None)[]:
	i: 3(loop)
	o: 22(for), 215(AF)

nname: 3
n 3(None)[]:
	i: 0(try)
	o: 6(loop), 216(AL)

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 220(except)

nname: 234
n 234(None)[return {'config': None, 'values': dict(<genexpr>(PY_RANK_PARAMS))}
]:
	i: 220(), 0(AL), 6(AF), 22(f), 53()
	o: 

nname: 220
n 220(None)[except:
	PRINT_EXCEPTION()
]:
	i: 0()
	o: 234()

nname: 234
n 234(None)[return {'config': None, 'values': dict(<genexpr>(PY_RANK_PARAMS))}
]:
	i: 220(), 0(AL), 6(AF), 22(f), 53()
	o: 

nname: 53
n 53(None)[if params[3] == 'upnp':
	infos = self._get_network_infos(params[1])
	params[4] = infos['ip']
	params[5] = infos['netmask']
	params[6] = infos['gateway']
	params[7] = infos['dns1']
	params[8] = infos['dns2']
return {'config': config, 'values': dict(<genexpr>(PY_RANK_PARAMS))}
continue
]:
	i: 22(t)
	o: 234()

nname: 22
n 22(params[0])[for config in self.pynet.getConfigurations():
params = self.pynet.getConfiguration(config)
]:
	i: 6(for)
	o: 53(t), 234(f)

nname: 6
n 6(None)[]:
	i: 0(loop)
	o: 22(for), 234(AF)

nname: 0
n 0(None)[try:
]:
	i: 
	o: 6(loop), 234(AL), 220()

nname: 234
n 234(None)[return {'config': None, 'values': dict(<genexpr>(PY_RANK_PARAMS))}
]:
	i: 220(), 0(AL), 6(AF), 22(f)
	o: 

nname: 220
n 220(None)[except:
	PRINT_EXCEPTION()
]:
	i: 0()
	o: 234()

nname: 234
n 234(None)[return {'config': None, 'values': dict(<genexpr>(PY_RANK_PARAMS))}
]:
	i: 220(), 0(AL), 6(AF), 22(f)
	o: 

nname: 22
n 22(None)[for config in self.pynet.getConfigurations():
params = self.pynet.getConfiguration(config)
if params[0]:
	if params[3] == 'upnp':
		infos = self._get_network_infos(params[1])
		params[4] = infos['ip']
		params[5] = infos['netmask']
		params[6] = infos['gateway']
		params[7] = infos['dns1']
		params[8] = infos['dns2']
	return {'config': config, 'values': dict(<genexpr>(PY_RANK_PARAMS))}
	continue
]:
	i: 6(for)
	o: 234()

nname: 6
n 6(None)[]:
	i: 0(loop)
	o: 22(for), 234(AF)

nname: 0
n 0(None)[try:
]:
	i: 
	o: 6(loop), 234(AL), 220()

self.nodes: {0: <unpyclib.structure.node instance at 0xb75e6d6c>, 6: <unpyclib.structure.node instance at 0xb7646a2c>, 234: <unpyclib.structure.node instance at 0xb764610c>, 22: <unpyclib.structure.node instance at 0xb75e690c>, 220: <unpyclib.structure.node instance at 0xb76462ac>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['ip']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b6ac>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['ip']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['netmask']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b6ac>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['netmask']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['gateway']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b6ac>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['gateway']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['dns1']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b6ac>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['dns1']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['dns2']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b6ac>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['dns2']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['type']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b6ac>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']['type']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 0
n 0(None)[return self._get_hwaddr()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 0
n 0(None)[return self._get_hwaddr()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b08c>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 0
n 0(None)[return self.get_active_configuration()['values']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b76c>}
nname: 57
n 57(None)[return None
]:
	i: 3(), 23(), 56(AE)
	o: 

nname: 23
n 23(None)[log.error('Failed to get config: %s', name)
PRINT_EXCEPTION()
return None
]:
	i: 0(except)
	o: 57()

nname: 3
n 3(None)[return self.pynet.getConfiguration(name)
]:
	i: 0(try)
	o: 57()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 23(except)

nname: 23
n 23(None)[except:
	log.error('Failed to get config: %s', name)
	PRINT_EXCEPTION()
	return None
return None
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	return self.pynet.getConfiguration(name)
]:
	i: 
	o: 23()

nname: 0
n 0(None)[try:
	return self.pynet.getConfiguration(name)
except:
	log.error('Failed to get config: %s', name)
	PRINT_EXCEPTION()
	return None
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764460c>}
nname: 129
n 129(None)[]:
	i: 32(), 106()
	o: 

nname: 32
n 32(None)[PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 129()

nname: 106
n 106(None)[self.pynet.setConfiguration(config, *old_params[1:])
]:
	i: 46(AL), 105()
	o: 129()

nname: 105
n 105(None)[]:
	i: 49(AF), 101()
	o: 106()

nname: 101
n 101(None)[]:
	i: 62(f), 83()
	o: 105()

nname: 83
n 83(None)[old_params[PY_RANK_PARAMS[k]] = v
continue
]:
	i: 62(t)
	o: 101()

nname: 62
n 62(k in PY_RANK_PARAMS)[for k, v in new_params.iteritems():
]:
	i: 49(for)
	o: 83(t), 101(f)

nname: 49
n 49(None)[]:
	i: 46(loop)
	o: 62(for), 105(AF)

nname: 46
n 46(None)[]:
	i: 13(), 45(AE)
	o: 49(loop), 106(AL)

nname: 13
n 13(None)[old_params = self.get_configuration_by_name(config)
]:
	i: 0(try)
	o: 46()

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
]:
	i: 
	o: 13(try), 32(except)

nname: 129
n 129(None)[]:
	i: 32(), 106()
	o: 

nname: 32
n 32(None)[except:
	PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 129()

nname: 106
n 106(None)[self.pynet.setConfiguration(config, *old_params[1:])
]:
	i: 46(AL), 49(AF), 62()
	o: 129()

nname: 62
n 62(None)[for k, v in new_params.iteritems():
if k in PY_RANK_PARAMS:
	old_params[PY_RANK_PARAMS[k]] = v
	continue
]:
	i: 49(for)
	o: 106()

nname: 49
n 49(None)[]:
	i: 46(loop)
	o: 62(for), 106(AF)

nname: 46
n 46(None)[]:
	i: 13(), 45(AE)
	o: 49(loop), 106(AL)

nname: 13
n 13(None)[old_params = self.get_configuration_by_name(config)
]:
	i: 0(try)
	o: 46()

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
]:
	i: 
	o: 13(try), 32(except)

nname: 129
n 129(None)[]:
	i: 32(), 62()
	o: 

nname: 32
n 32(None)[except:
	PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 129()

nname: 62
n 62(None)[for k, v in new_params.iteritems():
	if k in PY_RANK_PARAMS:
		old_params[PY_RANK_PARAMS[k]] = v
		continue
self.pynet.setConfiguration(config, *old_params[1:])
]:
	i: 46(for)
	o: 129()

nname: 46
n 46(None)[]:
	i: 13(), 45(AE)
	o: 62(for)

nname: 13
n 13(None)[old_params = self.get_configuration_by_name(config)
]:
	i: 0(try)
	o: 46()

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
]:
	i: 
	o: 13(try), 32(except)

nname: 129
n 129(None)[]:
	i: 32(), 46()
	o: 

nname: 32
n 32(None)[except:
	PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 129()

nname: 46
n 46(None)[for k, v in new_params.iteritems():
	if k in PY_RANK_PARAMS:
		old_params[PY_RANK_PARAMS[k]] = v
		continue
self.pynet.setConfiguration(config, *old_params[1:])
]:
	i: 13(), 45(AE)
	o: 129()

nname: 13
n 13(None)[old_params = self.get_configuration_by_name(config)
]:
	i: 0(try)
	o: 46()

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
]:
	i: 
	o: 13(try), 32(except)

nname: 129
n 129(None)[]:
	i: 32()
	o: 

nname: 32
n 32(None)[except:
	PRINT_EXCEPTION()
else:
	for k, v in new_params.iteritems():
		if k in PY_RANK_PARAMS:
			old_params[PY_RANK_PARAMS[k]] = v
			continue
	self.pynet.setConfiguration(config, *old_params[1:])
]:
	i: 0()
	o: 129()

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
try:
	old_params = self.get_configuration_by_name(config)
]:
	i: 
	o: 32()

nname: 129
n 129(None)[]:
	i: 0()
	o: 

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
try:
	old_params = self.get_configuration_by_name(config)
except:
	PRINT_EXCEPTION()
else:
	for k, v in new_params.iteritems():
		if k in PY_RANK_PARAMS:
			old_params[PY_RANK_PARAMS[k]] = v
			continue
	self.pynet.setConfiguration(config, *old_params[1:])
]:
	i: 
	o: 129()

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
try:
	old_params = self.get_configuration_by_name(config)
except:
	PRINT_EXCEPTION()
else:
	for k, v in new_params.iteritems():
		if k in PY_RANK_PARAMS:
			old_params[PY_RANK_PARAMS[k]] = v
			continue
	self.pynet.setConfiguration(config, *old_params[1:])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7644aac>}
nname: 100
n 100(None)[return None
]:
	i: 55(JA), 82(JA), 96(), 99()
	o: 

nname: 99
n 99(None)[]:
	i: 0&27(f)
	o: 100()

nname: 82
n 82(None)[PRINT_EXCEPTION()
]:
	i: 37(except)
	o: 100(JA)

nname: 55
n 55(None)[self.pynet.setConfiguration(config, *ret[1:])
]:
	i: 37(try)
	o: 100(JA)

nname: 37
n 37(None)[ret[PY_RANK_PARAMS[where]] = val
]:
	i: 0&27(t)
	o: 55(try), 82(except)

nname: 0&27
n 0&27(ret is not None and self.pynet)[ret = self.get_configuration_by_name(config)
]:
	i: 
	o: 37(t), 99(f)

nname: 100
n 100(None)[return None
]:
	i: 82(JA), 96(), 0&27(f)
	o: 

nname: 82
n 82(None)[except:
	PRINT_EXCEPTION()
]:
	i: 37()
	o: 100(JA)

nname: 37
n 37(None)[ret[PY_RANK_PARAMS[where]] = val
try:
	self.pynet.setConfiguration(config, *ret[1:])
]:
	i: 0&27(t)
	o: 82()

nname: 0&27
n 0&27(ret is not None and self.pynet)[ret = self.get_configuration_by_name(config)
]:
	i: 
	o: 37(t), 100(f)

nname: 100
n 100(None)[return None
]:
	i: 37(JA), 96(), 0&27(f)
	o: 

nname: 37
n 37(None)[ret[PY_RANK_PARAMS[where]] = val
try:
	self.pynet.setConfiguration(config, *ret[1:])
except:
	PRINT_EXCEPTION()
]:
	i: 0&27(t)
	o: 100(JA)

nname: 0&27
n 0&27(ret is not None and self.pynet)[ret = self.get_configuration_by_name(config)
]:
	i: 
	o: 37(t), 100(f)

nname: 100
n 100(None)[return None
]:
	i: 96(), 0&27(f)
	o: 

nname: 0&27
n 0&27(None)[ret = self.get_configuration_by_name(config)
if ret is not None and self.pynet:
	ret[PY_RANK_PARAMS[where]] = val
	try:
		self.pynet.setConfiguration(config, *ret[1:])
	except:
		PRINT_EXCEPTION()
]:
	i: 
	o: 100(JA)

self.nodes: {96: <unpyclib.structure.node instance at 0xb7644a6c>, 100: <unpyclib.structure.node instance at 0xb7644d0c>, '0&27': <unpyclib.structure.node instance at 0xb76449cc>, 95: <unpyclib.structure.node instance at 0xb7644aec>}
nname: 75
n 75(None)[]:
	i: 0(AL), 74()
	o: 

nname: 74
n 74(None)[]:
	i: 13(AF), 70()
	o: 75()

nname: 70
n 70(None)[]:
	i: 26(f), 47()
	o: 74()

nname: 47
n 47(None)[self.set_value_config(config, k, v)
continue
]:
	i: 26(t)
	o: 70()

nname: 26
n 26(k in PY_RANK_PARAMS)[for k, v in mapping_val.iteritems():
]:
	i: 13(for)
	o: 47(t), 70(f)

nname: 13
n 13(None)[]:
	i: 0(loop)
	o: 26(for), 74(AF)

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
]:
	i: 
	o: 13(loop), 75(AL)

nname: 75
n 75(None)[]:
	i: 0(AL), 13(AF), 26()
	o: 

nname: 26
n 26(None)[for k, v in mapping_val.iteritems():
if k in PY_RANK_PARAMS:
	self.set_value_config(config, k, v)
	continue
]:
	i: 13(for)
	o: 75()

nname: 13
n 13(None)[]:
	i: 0(loop)
	o: 26(for), 75(AF)

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
]:
	i: 
	o: 13(loop), 75(AL)

nname: 26
n 26(None)[for k, v in mapping_val.iteritems():
	if k in PY_RANK_PARAMS:
		self.set_value_config(config, k, v)
		continue
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
]:
	i: 
	o: 26(for)

nname: 0
n 0(None)[config = PYNET_DEVICE[config]
for k, v in mapping_val.iteritems():
	if k in PY_RANK_PARAMS:
		self.set_value_config(config, k, v)
		continue
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76444ac>}
nname: 113
n 113(None)[return (auth, cypher, key_mgt)
]:
	i: 64(JA), 95(JA), 109(), 112()
	o: 

nname: 112
n 112(None)[]:
	i: 0&41(f)
	o: 113()

nname: 95
n 95(None)[PRINT_EXCEPTION()
]:
	i: 51(except)
	o: 113(JA)

nname: 64
n 64(None)[auth, cypher, key_mgt = self.pynet.getNetworkCapabilities(net_path)
]:
	i: 51(try)
	o: 113(JA)

nname: 51
n 51(None)[net_path = net.object_path
]:
	i: 0&41(t)
	o: 64(try), 95(except)

nname: 0&41
n 0&41(net is not None and self.pynet)[auth, cypher, key_mgt = None, None, None
net = self.get_net_by_name(ssid)
]:
	i: 
	o: 51(t), 112(f)

nname: 113
n 113(None)[return (auth, cypher, key_mgt)
]:
	i: 95(JA), 109(), 0&41(f)
	o: 

nname: 95
n 95(None)[except:
	PRINT_EXCEPTION()
]:
	i: 51()
	o: 113(JA)

nname: 51
n 51(None)[net_path = net.object_path
try:
	auth, cypher, key_mgt = self.pynet.getNetworkCapabilities(net_path)
]:
	i: 0&41(t)
	o: 95()

nname: 0&41
n 0&41(net is not None and self.pynet)[auth, cypher, key_mgt = None, None, None
net = self.get_net_by_name(ssid)
]:
	i: 
	o: 51(t), 113(f)

nname: 113
n 113(None)[return (auth, cypher, key_mgt)
]:
	i: 51(JA), 109(), 0&41(f)
	o: 

nname: 51
n 51(None)[net_path = net.object_path
try:
	auth, cypher, key_mgt = self.pynet.getNetworkCapabilities(net_path)
except:
	PRINT_EXCEPTION()
]:
	i: 0&41(t)
	o: 113(JA)

nname: 0&41
n 0&41(net is not None and self.pynet)[auth, cypher, key_mgt = None, None, None
net = self.get_net_by_name(ssid)
]:
	i: 
	o: 51(t), 113(f)

nname: 113
n 113(None)[return (auth, cypher, key_mgt)
]:
	i: 109(), 0&41(f)
	o: 

nname: 0&41
n 0&41(None)[auth, cypher, key_mgt = None, None, None
net = self.get_net_by_name(ssid)
if net is not None and self.pynet:
	net_path = net.object_path
	try:
		auth, cypher, key_mgt = self.pynet.getNetworkCapabilities(net_path)
	except:
		PRINT_EXCEPTION()
]:
	i: 
	o: 113(JA)

self.nodes: {108: <unpyclib.structure.node instance at 0xb7644a0c>, 109: <unpyclib.structure.node instance at 0xb7644f6c>, 113: <unpyclib.structure.node instance at 0xb7644aac>, '0&41': <unpyclib.structure.node instance at 0xb764490c>}
nname: 117
n 117(None)[return None
]:
	i: 51(JA), 91(JA), 109(), 112()
	o: 

nname: 112
n 112(None)[return False
]:
	i: 0&37(f)
	o: 117()

nname: 91
n 91(None)[PRINT_EXCEPTION()
return False
]:
	i: 47(except)
	o: 117(JA)

nname: 51
n 51(None)[self.pynet.setActiveConfiguration(config)
log.debug('Set %s as active network configuration', config)
return True
]:
	i: 47(try)
	o: 117(JA)

nname: 47
n 47(None)[]:
	i: 0&37(t)
	o: 51(try), 91(except)

nname: 0&37
n 0&37(ret is not None and self.pynet)[config = PYNET_DEVICE[config]
ret = self.get_configuration_by_name(config)
]:
	i: 
	o: 47(t), 112(f)

nname: 117
n 117(None)[return None
]:
	i: 91(JA), 109(), 112()
	o: 

nname: 112
n 112(None)[return False
]:
	i: 0&37(f)
	o: 117()

nname: 91
n 91(None)[except:
	PRINT_EXCEPTION()
	return False
]:
	i: 47()
	o: 117(JA)

nname: 47
n 47(None)[try:
	self.pynet.setActiveConfiguration(config)
	log.debug('Set %s as active network configuration', config)
	return True
]:
	i: 0&37(t)
	o: 91()

nname: 0&37
n 0&37(ret is not None and self.pynet)[config = PYNET_DEVICE[config]
ret = self.get_configuration_by_name(config)
]:
	i: 
	o: 47(t), 112(f)

nname: 117
n 117(None)[return None
]:
	i: 47(JA), 109(), 112()
	o: 

nname: 112
n 112(None)[return False
]:
	i: 0&37(f)
	o: 117()

nname: 47
n 47(None)[try:
	self.pynet.setActiveConfiguration(config)
	log.debug('Set %s as active network configuration', config)
	return True
except:
	PRINT_EXCEPTION()
	return False
]:
	i: 0&37(t)
	o: 117(JA)

nname: 0&37
n 0&37(ret is not None and self.pynet)[config = PYNET_DEVICE[config]
ret = self.get_configuration_by_name(config)
]:
	i: 
	o: 47(t), 112(f)

nname: 117
n 117(None)[return None
]:
	i: 0&37(JA), 109()
	o: 

nname: 0&37
n 0&37(None)[config = PYNET_DEVICE[config]
ret = self.get_configuration_by_name(config)
if ret is not None and self.pynet:
	try:
		self.pynet.setActiveConfiguration(config)
		log.debug('Set %s as active network configuration', config)
		return True
	except:
		PRINT_EXCEPTION()
		return False
else:
	return False
]:
	i: 
	o: 117(JA)

self.nodes: {'0&37': <unpyclib.structure.node instance at 0xb764494c>, 108: <unpyclib.structure.node instance at 0xb7644ecc>, 109: <unpyclib.structure.node instance at 0xb764488c>, 117: <unpyclib.structure.node instance at 0xb76447ac>}
nname: 110
n 110(None)[]:
	i: 0(AL), 109()
	o: 

nname: 109
n 109(None)[]:
	i: 22(AF), 84()
	o: 110()

nname: 84
n 84(None)[Task(o.device_added).start(2)
]:
	i: 38(), 82(AE)
	o: 109()

nname: 82
n 82(None)[]:
	i: 49(f), 59()
	o: 84(AE)

nname: 59
n 59(None)[log.debug('%r has not device_added', o)
continue
]:
	i: 49(t)
	o: 82()

nname: 49
n 49(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 32(except)
	o: 59(t), 82(f)

nname: 38
n 38(None)[o.device_added
]:
	i: 32(try)
	o: 84()

nname: 32
n 32(None)[for o in self._obs:
]:
	i: 22(for)
	o: 38(try), 49(except)

nname: 22
n 22(None)[]:
	i: 0(loop)
	o: 32(for), 109(AF)

nname: 0
n 0(None)[log.debug('sig DeviceAdded(%s, %s)', obj, name)
]:
	i: 
	o: 22(loop), 110(AL)

nname: 110
n 110(None)[]:
	i: 0(AL), 22(AF), 84()
	o: 

nname: 84
n 84(None)[Task(o.device_added).start(2)
]:
	i: 38(), 49(AE)
	o: 110()

nname: 49
n 49(None)[except AttributeError:
	log.debug('%r has not device_added', o)
	continue
]:
	i: 32(except)
	o: 84(AE)

nname: 38
n 38(None)[o.device_added
]:
	i: 32(try)
	o: 84()

nname: 32
n 32(None)[for o in self._obs:
]:
	i: 22(for)
	o: 38(try), 49(except)

nname: 22
n 22(None)[]:
	i: 0(loop)
	o: 32(for), 110(AF)

nname: 0
n 0(None)[log.debug('sig DeviceAdded(%s, %s)', obj, name)
]:
	i: 
	o: 22(loop), 110(AL)

updateEdges Exception 49
postorder Exception 49
nname: 110
n 110(None)[]:
	i: 0(AL), 22(AF), 84()
	o: 

simplifyConsecutive Exception 49
self.nodes: {0: <unpyclib.structure.node instance at 0xb7644a2c>, 32: <unpyclib.structure.node instance at 0xb7644aec>, 110: <unpyclib.structure.node instance at 0xb76445cc>, 84: <unpyclib.structure.node instance at 0xb7644b0c>, 22: <unpyclib.structure.node instance at 0xb764482c>}
simplifyConsecutive Exception 49
nname: 110
n 110(None)[]:
	i: 0(AL), 109()
	o: 

nname: 109
n 109(None)[]:
	i: 22(AF), 84()
	o: 110()

nname: 84
n 84(None)[Task(o.wireless_network_appeared).start(0.5)
]:
	i: 38(), 82(AE)
	o: 109()

nname: 82
n 82(None)[]:
	i: 49(f), 59()
	o: 84(AE)

nname: 59
n 59(None)[log.debug('%r has not wireless_network_appeared', o)
continue
]:
	i: 49(t)
	o: 82()

nname: 49
n 49(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 32(except)
	o: 59(t), 82(f)

nname: 38
n 38(None)[o.wireless_network_appeared
]:
	i: 32(try)
	o: 84()

nname: 32
n 32(None)[for o in self._obs:
]:
	i: 22(for)
	o: 38(try), 49(except)

nname: 22
n 22(None)[]:
	i: 0(loop)
	o: 32(for), 109(AF)

nname: 0
n 0(None)[log.debug('sig WirelessNetworkAppeared (%s) on (%s)', net, dev)
]:
	i: 
	o: 22(loop), 110(AL)

nname: 110
n 110(None)[]:
	i: 0(AL), 22(AF), 84()
	o: 

nname: 84
n 84(None)[Task(o.wireless_network_appeared).start(0.5)
]:
	i: 38(), 49(AE)
	o: 110()

nname: 49
n 49(None)[except AttributeError:
	log.debug('%r has not wireless_network_appeared', o)
	continue
]:
	i: 32(except)
	o: 84(AE)

nname: 38
n 38(None)[o.wireless_network_appeared
]:
	i: 32(try)
	o: 84()

nname: 32
n 32(None)[for o in self._obs:
]:
	i: 22(for)
	o: 38(try), 49(except)

nname: 22
n 22(None)[]:
	i: 0(loop)
	o: 32(for), 110(AF)

nname: 0
n 0(None)[log.debug('sig WirelessNetworkAppeared (%s) on (%s)', net, dev)
]:
	i: 
	o: 22(loop), 110(AL)

updateEdges Exception 49
postorder Exception 49
nname: 110
n 110(None)[]:
	i: 0(AL), 22(AF), 84()
	o: 

simplifyConsecutive Exception 49
self.nodes: {0: <unpyclib.structure.node instance at 0xb764480c>, 32: <unpyclib.structure.node instance at 0xb7644d8c>, 110: <unpyclib.structure.node instance at 0xb7644ccc>, 84: <unpyclib.structure.node instance at 0xb76447ec>, 22: <unpyclib.structure.node instance at 0xb7644f4c>}
simplifyConsecutive Exception 49
nname: 110
n 110(None)[]:
	i: 0(AL), 109()
	o: 

nname: 109
n 109(None)[]:
	i: 22(AF), 84()
	o: 110()

nname: 84
n 84(None)[Task(o.wireless_network_disappeared).start(0.5)
]:
	i: 38(), 82(AE)
	o: 109()

nname: 82
n 82(None)[]:
	i: 49(f), 59()
	o: 84(AE)

nname: 59
n 59(None)[log.debug('%r has not wireless_network_disappeared', o)
continue
]:
	i: 49(t)
	o: 82()

nname: 49
n 49(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 32(except)
	o: 59(t), 82(f)

nname: 38
n 38(None)[o.wireless_network_disappeared
]:
	i: 32(try)
	o: 84()

nname: 32
n 32(None)[for o in self._obs:
]:
	i: 22(for)
	o: 38(try), 49(except)

nname: 22
n 22(None)[]:
	i: 0(loop)
	o: 32(for), 109(AF)

nname: 0
n 0(None)[log.debug('sig WirelessNetworkDisappeared (%s) on (%s)', net, dev)
]:
	i: 
	o: 22(loop), 110(AL)

nname: 110
n 110(None)[]:
	i: 0(AL), 22(AF), 84()
	o: 

nname: 84
n 84(None)[Task(o.wireless_network_disappeared).start(0.5)
]:
	i: 38(), 49(AE)
	o: 110()

nname: 49
n 49(None)[except AttributeError:
	log.debug('%r has not wireless_network_disappeared', o)
	continue
]:
	i: 32(except)
	o: 84(AE)

nname: 38
n 38(None)[o.wireless_network_disappeared
]:
	i: 32(try)
	o: 84()

nname: 32
n 32(None)[for o in self._obs:
]:
	i: 22(for)
	o: 38(try), 49(except)

nname: 22
n 22(None)[]:
	i: 0(loop)
	o: 32(for), 110(AF)

nname: 0
n 0(None)[log.debug('sig WirelessNetworkDisappeared (%s) on (%s)', net, dev)
]:
	i: 
	o: 22(loop), 110(AL)

updateEdges Exception 49
postorder Exception 49
nname: 110
n 110(None)[]:
	i: 0(AL), 22(AF), 84()
	o: 

simplifyConsecutive Exception 49
self.nodes: {0: <unpyclib.structure.node instance at 0xb764466c>, 32: <unpyclib.structure.node instance at 0xb764490c>, 110: <unpyclib.structure.node instance at 0xb764476c>, 84: <unpyclib.structure.node instance at 0xb764450c>, 22: <unpyclib.structure.node instance at 0xb764486c>}
simplifyConsecutive Exception 49
nname: 107
n 107(None)[]:
	i: 0(AL), 106()
	o: 

nname: 106
n 106(None)[]:
	i: 19(AF), 81()
	o: 107()

nname: 81
n 81(None)[Task(o.device_now_active).start(0.5)
]:
	i: 35(), 79(AE)
	o: 106()

nname: 79
n 79(None)[]:
	i: 46(f), 56()
	o: 81(AE)

nname: 56
n 56(None)[log.debug('%r has not device_now_active', o)
continue
]:
	i: 46(t)
	o: 79()

nname: 46
n 46(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 29(except)
	o: 56(t), 79(f)

nname: 35
n 35(None)[o.device_now_active
]:
	i: 29(try)
	o: 81()

nname: 29
n 29(None)[for o in self._obs:
]:
	i: 19(for)
	o: 35(try), 46(except)

nname: 19
n 19(None)[]:
	i: 0(loop)
	o: 29(for), 106(AF)

nname: 0
n 0(None)[log.debug('sig DeviceNowActive (%s)', dev)
]:
	i: 
	o: 19(loop), 107(AL)

nname: 107
n 107(None)[]:
	i: 0(AL), 19(AF), 81()
	o: 

nname: 81
n 81(None)[Task(o.device_now_active).start(0.5)
]:
	i: 35(), 46(AE)
	o: 107()

nname: 46
n 46(None)[except AttributeError:
	log.debug('%r has not device_now_active', o)
	continue
]:
	i: 29(except)
	o: 81(AE)

nname: 35
n 35(None)[o.device_now_active
]:
	i: 29(try)
	o: 81()

nname: 29
n 29(None)[for o in self._obs:
]:
	i: 19(for)
	o: 35(try), 46(except)

nname: 19
n 19(None)[]:
	i: 0(loop)
	o: 29(for), 107(AF)

nname: 0
n 0(None)[log.debug('sig DeviceNowActive (%s)', dev)
]:
	i: 
	o: 19(loop), 107(AL)

updateEdges Exception 46
postorder Exception 46
nname: 107
n 107(None)[]:
	i: 0(AL), 19(AF), 81()
	o: 

simplifyConsecutive Exception 46
self.nodes: {0: <unpyclib.structure.node instance at 0xb764488c>, 107: <unpyclib.structure.node instance at 0xb76447cc>, 81: <unpyclib.structure.node instance at 0xb7644a0c>, 19: <unpyclib.structure.node instance at 0xb76448ec>, 29: <unpyclib.structure.node instance at 0xb76449ec>}
simplifyConsecutive Exception 46
nname: 107
n 107(None)[]:
	i: 0(AL), 106()
	o: 

nname: 106
n 106(None)[]:
	i: 19(AF), 81()
	o: 107()

nname: 81
n 81(None)[Task(o.device_now_active).start(0.5)
]:
	i: 35(), 79(AE)
	o: 106()

nname: 79
n 79(None)[]:
	i: 46(f), 56()
	o: 81(AE)

nname: 56
n 56(None)[log.debug('%r has not device_now_active', o)
continue
]:
	i: 46(t)
	o: 79()

nname: 46
n 46(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 29(except)
	o: 56(t), 79(f)

nname: 35
n 35(None)[o.device_now_active
]:
	i: 29(try)
	o: 81()

nname: 29
n 29(None)[for o in self._obs:
]:
	i: 19(for)
	o: 35(try), 46(except)

nname: 19
n 19(None)[]:
	i: 0(loop)
	o: 29(for), 106(AF)

nname: 0
n 0(None)[log.debug('sig DeviceNowActive (%s)', dev)
]:
	i: 
	o: 19(loop), 107(AL)

nname: 107
n 107(None)[]:
	i: 0(AL), 19(AF), 81()
	o: 

nname: 81
n 81(None)[Task(o.device_now_active).start(0.5)
]:
	i: 35(), 46(AE)
	o: 107()

nname: 46
n 46(None)[except AttributeError:
	log.debug('%r has not device_now_active', o)
	continue
]:
	i: 29(except)
	o: 81(AE)

nname: 35
n 35(None)[o.device_now_active
]:
	i: 29(try)
	o: 81()

nname: 29
n 29(None)[for o in self._obs:
]:
	i: 19(for)
	o: 35(try), 46(except)

nname: 19
n 19(None)[]:
	i: 0(loop)
	o: 29(for), 107(AF)

nname: 0
n 0(None)[log.debug('sig DeviceNowActive (%s)', dev)
]:
	i: 
	o: 19(loop), 107(AL)

updateEdges Exception 46
postorder Exception 46
nname: 107
n 107(None)[]:
	i: 0(AL), 19(AF), 81()
	o: 

simplifyConsecutive Exception 46
self.nodes: {0: <unpyclib.structure.node instance at 0xb764490c>, 107: <unpyclib.structure.node instance at 0xb764486c>, 81: <unpyclib.structure.node instance at 0xb764494c>, 19: <unpyclib.structure.node instance at 0xb76448ec>, 29: <unpyclib.structure.node instance at 0xb764478c>}
simplifyConsecutive Exception 46
nname: 107
n 107(None)[]:
	i: 0(AL), 106()
	o: 

nname: 106
n 106(None)[]:
	i: 19(AF), 81()
	o: 107()

nname: 81
n 81(None)[Task(o.device_no_longer_active).start(0.5)
]:
	i: 35(), 79(AE)
	o: 106()

nname: 79
n 79(None)[]:
	i: 46(f), 56()
	o: 81(AE)

nname: 56
n 56(None)[log.debug('%r has not device_now_longer_active', o)
continue
]:
	i: 46(t)
	o: 79()

nname: 46
n 46(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 29(except)
	o: 56(t), 79(f)

nname: 35
n 35(None)[o.device_no_longer_active
]:
	i: 29(try)
	o: 81()

nname: 29
n 29(None)[for o in self._obs:
]:
	i: 19(for)
	o: 35(try), 46(except)

nname: 19
n 19(None)[]:
	i: 0(loop)
	o: 29(for), 106(AF)

nname: 0
n 0(None)[log.debug('sig DeviceNoLongerActive (%s)', dev)
]:
	i: 
	o: 19(loop), 107(AL)

nname: 107
n 107(None)[]:
	i: 0(AL), 19(AF), 81()
	o: 

nname: 81
n 81(None)[Task(o.device_no_longer_active).start(0.5)
]:
	i: 35(), 46(AE)
	o: 107()

nname: 46
n 46(None)[except AttributeError:
	log.debug('%r has not device_now_longer_active', o)
	continue
]:
	i: 29(except)
	o: 81(AE)

nname: 35
n 35(None)[o.device_no_longer_active
]:
	i: 29(try)
	o: 81()

nname: 29
n 29(None)[for o in self._obs:
]:
	i: 19(for)
	o: 35(try), 46(except)

nname: 19
n 19(None)[]:
	i: 0(loop)
	o: 29(for), 107(AF)

nname: 0
n 0(None)[log.debug('sig DeviceNoLongerActive (%s)', dev)
]:
	i: 
	o: 19(loop), 107(AL)

updateEdges Exception 46
postorder Exception 46
nname: 107
n 107(None)[]:
	i: 0(AL), 19(AF), 81()
	o: 

simplifyConsecutive Exception 46
self.nodes: {0: <unpyclib.structure.node instance at 0xb7644d4c>, 107: <unpyclib.structure.node instance at 0xb764498c>, 81: <unpyclib.structure.node instance at 0xb7644aac>, 19: <unpyclib.structure.node instance at 0xb76448ec>, 29: <unpyclib.structure.node instance at 0xb7644cac>}
simplifyConsecutive Exception 46
nname: 128
n 128(None)[]:
	i: 0(AL), 127()
	o: 

nname: 127
n 127(None)[]:
	i: 19(AF), 81()
	o: 128()

nname: 81
n 81(None)[t = Task(o.device_activation_failed)
t.args = (dev, ssid)
t.start(0.5)
]:
	i: 35(), 79(AE)
	o: 127()

nname: 79
n 79(None)[]:
	i: 46(f), 56()
	o: 81(AE)

nname: 56
n 56(None)[log.debug('%r has not device_activation_failed', o)
continue
]:
	i: 46(t)
	o: 79()

nname: 46
n 46(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 29(except)
	o: 56(t), 79(f)

nname: 35
n 35(None)[o.device_activation_failed
]:
	i: 29(try)
	o: 81()

nname: 29
n 29(None)[for o in self._obs:
]:
	i: 19(for)
	o: 35(try), 46(except)

nname: 19
n 19(None)[]:
	i: 0(loop)
	o: 29(for), 127(AF)

nname: 0
n 0(None)[log.debug('sig DeviceActivationFailed (%s)', dev)
]:
	i: 
	o: 19(loop), 128(AL)

nname: 128
n 128(None)[]:
	i: 0(AL), 19(AF), 81()
	o: 

nname: 81
n 81(None)[t = Task(o.device_activation_failed)
t.args = (dev, ssid)
t.start(0.5)
]:
	i: 35(), 46(AE)
	o: 128()

nname: 46
n 46(None)[except AttributeError:
	log.debug('%r has not device_activation_failed', o)
	continue
]:
	i: 29(except)
	o: 81(AE)

nname: 35
n 35(None)[o.device_activation_failed
]:
	i: 29(try)
	o: 81()

nname: 29
n 29(None)[for o in self._obs:
]:
	i: 19(for)
	o: 35(try), 46(except)

nname: 19
n 19(None)[]:
	i: 0(loop)
	o: 29(for), 128(AF)

nname: 0
n 0(None)[log.debug('sig DeviceActivationFailed (%s)', dev)
]:
	i: 
	o: 19(loop), 128(AL)

updateEdges Exception 46
postorder Exception 46
nname: 128
n 128(None)[]:
	i: 0(AL), 19(AF), 81()
	o: 

simplifyConsecutive Exception 46
self.nodes: {0: <unpyclib.structure.node instance at 0xb76449ec>, 128: <unpyclib.structure.node instance at 0xb764494c>, 81: <unpyclib.structure.node instance at 0xb764484c>, 19: <unpyclib.structure.node instance at 0xb7644b8c>, 29: <unpyclib.structure.node instance at 0xb7644d8c>}
simplifyConsecutive Exception 46
nname: 74
n 74(None)[return dev_list
]:
	i: 27(AL), 69(), 73()
	o: 

nname: 73
n 73(None)[]:
	i: 0(f)
	o: 74()

nname: 69
n 69(None)[]:
	i: 31(AF), 38()
	o: 74()

nname: 38
n 38(None)[for dev in devs:
dev_list.append(Device(self._wdb, dev))
]:
	i: 31(for)
	o: 69()

nname: 31
n 31(None)[]:
	i: 27(loop)
	o: 38(for), 69(AF)

nname: 27
n 27(None)[]:
	i: 0(t)
	o: 31(loop), 74(AL)

nname: 0
n 0(devs)[devs = call(self._getDevices)
dev_list = []
]:
	i: 
	o: 27(t), 73(f)

nname: 74
n 74(None)[return dev_list
]:
	i: 38(), 0(f)
	o: 

nname: 38
n 38(None)[for dev in devs:
	dev_list.append(Device(self._wdb, dev))
]:
	i: 27(for)
	o: 74()

nname: 27
n 27(None)[]:
	i: 0(t)
	o: 38(for)

nname: 0
n 0(devs)[devs = call(self._getDevices)
dev_list = []
]:
	i: 
	o: 27(t), 74(f)

nname: 74
n 74(None)[return dev_list
]:
	i: 27(), 0(f)
	o: 

nname: 27
n 27(None)[for dev in devs:
	dev_list.append(Device(self._wdb, dev))
]:
	i: 0(t)
	o: 74()

nname: 0
n 0(devs)[devs = call(self._getDevices)
dev_list = []
]:
	i: 
	o: 27(t), 74(f)

nname: 0
n 0(None)[devs = call(self._getDevices)
dev_list = []
if devs:
	for dev in devs:
		dev_list.append(Device(self._wdb, dev))
return dev_list
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764440c>}
nname: 38
n 38(None)[]:
	i: 3(), 27(), 37(AE)
	o: 

nname: 27
n 27(None)[return False
]:
	i: 0(except)
	o: 38()

nname: 3
n 3(None)[self._setActiveWlanDevice(dev_path, essid)
return True
]:
	i: 0(try)
	o: 38()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 27(except)

nname: 27
n 27(None)[except:
	return False
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	self._setActiveWlanDevice(dev_path, essid)
	return True
]:
	i: 
	o: 27()

nname: 0
n 0(None)[try:
	self._setActiveWlanDevice(dev_path, essid)
	return True
except:
	return False
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7644e8c>}
nname: 55
n 55(None)[]:
	i: 3(), 44(), 54(AE)
	o: 

nname: 44
n 44(None)[return False
]:
	i: 0(except)
	o: 55()

nname: 3
n 3(None)[self._setActiveWepDevice(dev_path, essid, NM_cyphers[cypher], key, IW_auth[auth_alg])
return True
]:
	i: 0(try)
	o: 55()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 44(except)

nname: 44
n 44(None)[except:
	return False
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	self._setActiveWepDevice(dev_path, essid, NM_cyphers[cypher], key, IW_auth[auth_alg])
	return True
]:
	i: 
	o: 44()

nname: 0
n 0(None)[try:
	self._setActiveWepDevice(dev_path, essid, NM_cyphers[cypher], key, IW_auth[auth_alg])
	return True
except:
	return False
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764470c>}
nname: 62
n 62(None)[]:
	i: 3(), 51(), 61(AE)
	o: 

nname: 51
n 51(None)[return False
]:
	i: 0(except)
	o: 62()

nname: 3
n 3(None)[self._setActiveWpaDevice(dev_path, essid, NM_cyphers[cypher], key, IW_wpa_versions[wpa_version], IW_key_mgt[key_mgt])
return True
]:
	i: 0(try)
	o: 62()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 51(except)

nname: 51
n 51(None)[except:
	return False
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	self._setActiveWpaDevice(dev_path, essid, NM_cyphers[cypher], key, IW_wpa_versions[wpa_version], IW_key_mgt[key_mgt])
	return True
]:
	i: 
	o: 51()

nname: 0
n 0(None)[try:
	self._setActiveWpaDevice(dev_path, essid, NM_cyphers[cypher], key, IW_wpa_versions[wpa_version], IW_key_mgt[key_mgt])
	return True
except:
	return False
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764440c>}
nname: 35
n 35(None)[]:
	i: 3(), 24(), 34(AE)
	o: 

nname: 24
n 24(None)[return False
]:
	i: 0(except)
	o: 35()

nname: 3
n 3(None)[self._setActiveEthDevice(dev_path)
return True
]:
	i: 0(try)
	o: 35()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 24(except)

nname: 24
n 24(None)[except:
	return False
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	self._setActiveEthDevice(dev_path)
	return True
]:
	i: 
	o: 24()

nname: 0
n 0(None)[try:
	self._setActiveEthDevice(dev_path)
	return True
except:
	return False
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76444cc>}
nname: 293
n 293(None)[return False
]:
	i: 268(JA), 289(), 292()
	o: 

nname: 292
n 292(None)[]:
	i: 69(f)
	o: 293()

nname: 289
n 289(None)[]:
	i: 152(JA), 188(JA), 233(JA), 272()
	o: 293()

nname: 272
n 272(None)[return self._NetworkManager__activate_eth(device.object_path)
]:
	i: 84(f)
	o: 289()

nname: 268
n 268(None)[]:
	i: 220(f)
	o: 293(JA)

nname: 233
n 233(None)[return self._NetworkManager__activate_wpa(device.object_path, essid, cypher, key, wpa_version, key_mgt)
]:
	i: 220(t)
	o: 289(JA)

nname: 220
n 220('WPA' in cypher)[]:
	i: 175(f)
	o: 233(t), 268(f)

nname: 188
n 188(None)[return self._NetworkManager__activate_wep(device.object_path, essid, cypher, key, auth_alg)
]:
	i: 175(t)
	o: 289(JA)

nname: 175
n 175('WEP' in cypher)[]:
	i: 124&139(f)
	o: 188(t), 220(f)

nname: 152
n 152(None)[return self._NetworkManager__activate_wlan(device.object_path, essid)
]:
	i: 124&139(t)
	o: 289(JA)

nname: 124&139
n 124&139(cypher is None or cypher == 'NM_AUTH_TYPE_NONE')[essid = network
]:
	i: 107(), 120()
	o: 152(t), 175(f)

nname: 120
n 120(None)[]:
	i: 91(f)
	o: 124&139()

nname: 107
n 107(None)[]:
	i: 91(t)
	o: 124&139()

nname: 91
n 91(isinstance(network, Network))[]:
	i: 84(t)
	o: 107(t), 120(f)

nname: 84
n 84(network)[]:
	i: 69(t)
	o: 91(t), 272(f)

nname: 69
n 69(isinstance(device, Device))[]:
	i: 49(), 68()
	o: 84(t), 292(f)

nname: 68
n 68(None)[]:
	i: 0(f)
	o: 69()

nname: 49
n 49(None)[device = self.get_dev_by_name(device)
]:
	i: 0(t)
	o: 69()

nname: 0
n 0(isinstance(device, str))[log.debug('active_device device=%s network=%s cypher=%s key=%s auth_alg=%s wpa_version=%s key_mgt=%s', device, network, cypher, key, auth_alg, wpa_version, key_mgt)
]:
	i: 
	o: 49(t), 68(f)

nname: 293
n 293(None)[return False
]:
	i: 220(f), 152(JA), 188(JA), 233(JA), 272(), 0(f)
	o: 

nname: 272
n 272(None)[return self._NetworkManager__activate_eth(device.object_path)
]:
	i: 84(f)
	o: 293()

nname: 233
n 233(None)[return self._NetworkManager__activate_wpa(device.object_path, essid, cypher, key, wpa_version, key_mgt)
]:
	i: 220(t)
	o: 293(JA)

nname: 220
n 220('WPA' in cypher)[]:
	i: 175(f)
	o: 233(t), 293(f)

nname: 188
n 188(None)[return self._NetworkManager__activate_wep(device.object_path, essid, cypher, key, auth_alg)
]:
	i: 175(t)
	o: 293(JA)

nname: 175
n 175('WEP' in cypher)[]:
	i: 91(f)
	o: 188(t), 220(f)

nname: 152
n 152(None)[return self._NetworkManager__activate_wlan(device.object_path, essid)
]:
	i: 91(t)
	o: 293(JA)

nname: 91
n 91(cypher is None or cypher == 'NM_AUTH_TYPE_NONE')[if isinstance(network, Network):
	pass
essid = network
]:
	i: 84(t)
	o: 152(t), 175(f)

nname: 84
n 84(network)[]:
	i: 0(t)
	o: 91(t), 272(f)

nname: 0
n 0(isinstance(device, Device))[log.debug('active_device device=%s network=%s cypher=%s key=%s auth_alg=%s wpa_version=%s key_mgt=%s', device, network, cypher, key, auth_alg, wpa_version, key_mgt)
if isinstance(device, str):
	device = self.get_dev_by_name(device)
]:
	i: 
	o: 84(t), 293(f)

nname: 0
n 0(None)[log.debug('active_device device=%s network=%s cypher=%s key=%s auth_alg=%s wpa_version=%s key_mgt=%s', device, network, cypher, key, auth_alg, wpa_version, key_mgt)
if isinstance(device, str):
	device = self.get_dev_by_name(device)
if isinstance(device, Device):
	if network:
		if isinstance(network, Network):
			pass
		essid = network
		if cypher is None or cypher == 'NM_AUTH_TYPE_NONE':
			return self._NetworkManager__activate_wlan(device.object_path, essid)
		else:
			if 'WEP' in cypher:
				return self._NetworkManager__activate_wep(device.object_path, essid, cypher, key, auth_alg)
			else:
				if 'WPA' in cypher:
					return self._NetworkManager__activate_wpa(device.object_path, essid, cypher, key, wpa_version, key_mgt)
	else:
		return self._NetworkManager__activate_eth(device.object_path)
return False
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764642c>}
nname: 34
n 34(None)[return None
]:
	i: 21(), 33()
	o: 

nname: 33
n 33(None)[]:
	i: 0(f)
	o: 34()

nname: 21
n 21(None)[return NM_state[state]
]:
	i: 0(t)
	o: 34()

nname: 0
n 0(state)[state = call(self._state)
]:
	i: 
	o: 21(t), 33(f)

nname: 0
n 0(None)[state = call(self._state)
if state:
	return NM_state[state]
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7644d2c>}
nname: 193
n 193(None)[return networks
]:
	i: 0(AL), 192()
	o: 

nname: 192
n 192(None)[]:
	i: 21(AF), 189()
	o: 193()

nname: 189
n 189(None)[]:
	i: 49(AL), 188()
	o: 192()

nname: 188
n 188(None)[]:
	i: 28(f), 184()
	o: 189()

nname: 184
n 184(None)[continue
]:
	i: 65(AF), 72()
	o: 188()

nname: 72
n 72(None)[for net in nets:
networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
]:
	i: 65(for)
	o: 184()

nname: 65
n 65(None)[]:
	i: 49(loop)
	o: 72(for), 184(AF)

nname: 49
n 49(None)[nets = dev.get_networks()
]:
	i: 28(t)
	o: 65(loop), 189(AL)

nname: 28
n 28(dev.get_type() == 'wireless')[for dev in devs:
]:
	i: 21(for)
	o: 49(t), 188(f)

nname: 21
n 21(None)[]:
	i: 0(loop)
	o: 28(for), 192(AF)

nname: 0
n 0(None)[networks = []
devs = self.get_devices()
]:
	i: 
	o: 21(loop), 193(AL)

nname: 193
n 193(None)[return networks
]:
	i: 0(AL), 21(AF), 49(AL), 28(f), 184()
	o: 

nname: 184
n 184(None)[continue
]:
	i: 65(AF), 72()
	o: 193()

nname: 72
n 72(None)[for net in nets:
networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
]:
	i: 65(for)
	o: 184()

nname: 65
n 65(None)[]:
	i: 49(loop)
	o: 72(for), 184(AF)

nname: 49
n 49(None)[nets = dev.get_networks()
]:
	i: 28(t)
	o: 65(loop), 193(AL)

nname: 28
n 28(dev.get_type() == 'wireless')[for dev in devs:
]:
	i: 21(for)
	o: 49(t), 193(f)

nname: 21
n 21(None)[]:
	i: 0(loop)
	o: 28(for), 193(AF)

nname: 0
n 0(None)[networks = []
devs = self.get_devices()
]:
	i: 
	o: 21(loop), 193(AL)

nname: 193
n 193(None)[return networks
]:
	i: 0(AL), 21(AF), 28(f), 72()
	o: 

nname: 72
n 72(None)[for net in nets:
	networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
else:
	continue
]:
	i: 49(for)
	o: 193()

nname: 49
n 49(None)[nets = dev.get_networks()
]:
	i: 28(t)
	o: 72(for)

nname: 28
n 28(dev.get_type() == 'wireless')[for dev in devs:
]:
	i: 21(for)
	o: 49(t), 193(f)

nname: 21
n 21(None)[]:
	i: 0(loop)
	o: 28(for), 193(AF)

nname: 0
n 0(None)[networks = []
devs = self.get_devices()
]:
	i: 
	o: 21(loop), 193(AL)

nname: 193
n 193(None)[return networks
]:
	i: 0(AL), 21(AF), 28(f), 49()
	o: 

nname: 49
n 49(None)[nets = dev.get_networks()
for net in nets:
	networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
else:
	continue
]:
	i: 28(t)
	o: 193()

nname: 28
n 28(dev.get_type() == 'wireless')[for dev in devs:
]:
	i: 21(for)
	o: 49(t), 193(f)

nname: 21
n 21(None)[]:
	i: 0(loop)
	o: 28(for), 193(AF)

nname: 0
n 0(None)[networks = []
devs = self.get_devices()
]:
	i: 
	o: 21(loop), 193(AL)

nname: 28
n 28(None)[for dev in devs:
	if dev.get_type() == 'wireless':
		nets = dev.get_networks()
		for net in nets:
			networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
		else:
			continue
return networks
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[networks = []
devs = self.get_devices()
]:
	i: 
	o: 28(for)

nname: 0
n 0(None)[networks = []
devs = self.get_devices()
for dev in devs:
	if dev.get_type() == 'wireless':
		nets = dev.get_networks()
		for net in nets:
			networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
		else:
			continue
return networks
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76447ec>}
nname: 50
n 50(None)[]:
	i: 0(AL), 49()
	o: 

nname: 49
n 49(None)[]:
	i: 3(AF), 45()
	o: 50()

nname: 45
n 45(None)[]:
	i: 16(f), 37()
	o: 49()

nname: 37
n 37(None)[return dev
continue
]:
	i: 16(t)
	o: 45()

nname: 16
n 16(dev.get_type() == 'ethernet')[for dev in self.get_devices():
]:
	i: 3(for)
	o: 37(t), 45(f)

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 49(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 50(AL)

nname: 50
n 50(None)[]:
	i: 0(AL), 3(AF), 16()
	o: 

nname: 16
n 16(None)[for dev in self.get_devices():
if dev.get_type() == 'ethernet':
	return dev
	continue
]:
	i: 3(for)
	o: 50()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 50(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 50(AL)

nname: 16
n 16(None)[for dev in self.get_devices():
	if dev.get_type() == 'ethernet':
		return dev
		continue
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[]:
	i: 
	o: 16(for)

nname: 0
n 0(None)[for dev in self.get_devices():
	if dev.get_type() == 'ethernet':
		return dev
		continue
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764448c>}
nname: 66
n 66(None)[]:
	i: 0(AL), 65()
	o: 

nname: 65
n 65(None)[]:
	i: 3(AF), 16()
	o: 66()

nname: 16
n 16(None)[for net in self.get_all_networks():
print '%s\t%s\t%s\t%s' % (net['strength'], net['encrypted'], net['device_obj'].get_name(), net['name'])
]:
	i: 3(for)
	o: 65()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 65(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 66(AL)

nname: 66
n 66(None)[]:
	i: 16()
	o: 

nname: 16
n 16(None)[for net in self.get_all_networks():
	print '%s\t%s\t%s\t%s' % (net['strength'], net['encrypted'], net['device_obj'].get_name(), net['name'])
]:
	i: 0(for)
	o: 66()

nname: 0
n 0(None)[]:
	i: 
	o: 16(for)

nname: 66
n 66(None)[]:
	i: 0()
	o: 

nname: 0
n 0(None)[for net in self.get_all_networks():
	print '%s\t%s\t%s\t%s' % (net['strength'], net['encrypted'], net['device_obj'].get_name(), net['name'])
]:
	i: 
	o: 66()

nname: 0
n 0(None)[for net in self.get_all_networks():
	print '%s\t%s\t%s\t%s' % (net['strength'], net['encrypted'], net['device_obj'].get_name(), net['name'])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764440c>}
nname: 50
n 50(None)[]:
	i: 0(AL), 49()
	o: 

nname: 49
n 49(None)[]:
	i: 3(AF), 45()
	o: 50()

nname: 45
n 45(None)[]:
	i: 16(f), 37()
	o: 49()

nname: 37
n 37(None)[return dev
continue
]:
	i: 16(t)
	o: 45()

nname: 16
n 16(dev.get_name() == name)[for dev in self.get_devices():
]:
	i: 3(for)
	o: 37(t), 45(f)

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 49(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 50(AL)

nname: 50
n 50(None)[]:
	i: 0(AL), 3(AF), 16()
	o: 

nname: 16
n 16(None)[for dev in self.get_devices():
if dev.get_name() == name:
	return dev
	continue
]:
	i: 3(for)
	o: 50()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 50(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 50(AL)

nname: 16
n 16(None)[for dev in self.get_devices():
	if dev.get_name() == name:
		return dev
		continue
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[]:
	i: 
	o: 16(for)

nname: 0
n 0(None)[for dev in self.get_devices():
	if dev.get_name() == name:
		return dev
		continue
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7644a8c>}
nname: 52
n 52(None)[]:
	i: 0(AL), 51()
	o: 

nname: 51
n 51(None)[]:
	i: 3(AF), 47()
	o: 52()

nname: 47
n 47(None)[]:
	i: 16(f), 35()
	o: 51()

nname: 35
n 35(None)[return net['network_obj']
continue
]:
	i: 16(t)
	o: 47()

nname: 16
n 16(net['name'] == essid)[for net in self.get_all_networks():
]:
	i: 3(for)
	o: 35(t), 47(f)

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 51(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 52(AL)

nname: 52
n 52(None)[]:
	i: 0(AL), 3(AF), 16()
	o: 

nname: 16
n 16(None)[for net in self.get_all_networks():
if net['name'] == essid:
	return net['network_obj']
	continue
]:
	i: 3(for)
	o: 52()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 16(for), 52(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 52(AL)

nname: 16
n 16(None)[for net in self.get_all_networks():
	if net['name'] == essid:
		return net['network_obj']
		continue
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[]:
	i: 
	o: 16(for)

nname: 0
n 0(None)[for net in self.get_all_networks():
	if net['name'] == essid:
		return net['network_obj']
		continue
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764434c>}
nname: 0
n 0(None)[print 'NM.show_networks()\n'
print 'ETH: NM.set_active_device(dev)'
print 'OPE: NM.set_active_device(dev, net)'
print 'WEP: NM.set_active_device(dev, net, cypher, key, auth_alg)'
print 'WPA: NM.set_active_device(dev, net, cypher, key, wpa_version, key_mgt)\n'
print 'dev: device object or device name (ra0)'
print 'net: network object or essid (wifi-test)\n'
print 'cyphers in:'
print NM_cyphers.keys()
print 'auth_alg in:'
print IW_auth.keys()
print 'wpa_version in:'
print IW_wpa_versions.keys()
print 'key_mgt in:'
print IW_key_mgt.keys()
print "\nEX: NM.set_active_device('eth1', 'wyplay-upnp', 'NM_AUTH_TYPE_WEP104', '852E2FB20D6756DC3DDF16CF9B', 'IW_AUTH_ALG_SHARED_KEY')"
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764b7cc>}
nname: 6
n 6(None)[__doc__ = ' Main class to control networkmanager '
__metaclass__ = MetaSingleton
def __init__(self):
	from peewee.dbus import peewee_dbus
	self._pynet = None
	self._wdb = peewee_dbus
	self._nm = self._wdb.reference(dbus_service, '/org/freedesktop/NetworkManager', 'org.freedesktop.NetworkManager')
	self._nm_sig = self._wdb.instance('/org/freedesktop/NetworkManager')
	self._getDevices = self._nm.method('getDevices', '', 'ao')
	self._state = self._nm.method('state', '', 'i')
	self._setActiveEthDevice = self._nm.method('setActiveDevice', 'o', '')
	self._setActiveWlanDevice = self._nm.method('setActiveDevice', 'os', '')
	self._setActiveWepDevice = self._nm.method('setActiveDevice', 'osisi', '')
	self._setActiveWpaDevice = self._nm.method('setActiveDevice', 'osisii', '')
	self._obs = []
	self._nm_sig.signal('DeviceAdded', 'os', self.device_added, 0)
	self._nm_sig.signal('DeviceNowActive', 'os', self.wireless_now_active, 0)
	self._nm_sig.signal('DeviceActivationFailed', 'os', self.device_activation_failed, 0)
	self._nm_sig.signal('WirelessNetworkAppeared', 'oo', self.wireless_network_appeared, 0)
	self._nm_sig.signal('WirelessNetworkDisappeared', 'oo', self.wireless_network_disappeared, 0)
	self.get_wireless_configuration = partial(self.get_configuration_by_name, 'Wireless')
	self.get_wired_configuration = partial(self.get_configuration_by_name, 'Ethernet')
	return None

def _get_pynet(self):
	if not self._pynet:
		try:
			self._pynet = pynetwork.WyNetworkModule_instance()
		except:
			log.warn('Unable to contect wynetwork')
			self._pynet = None

pynet = property(_get_pynet)
del _get_pynet
def register_observer(self, obs):
	self._obs.append(obs)

def unregister_observer(self, obj):
	self._obs.remove(obj)

def _get_hwaddr(self):
	ifconfig = os.popen('/sbin/ifconfig')
	raw = ifconfig.read()
	ifconfig.close()
	interface = self.get_active_configuration()['values']['interface']
	if interface is None:
		return '00:00:00:00:00:00'

def _get_dns_servers(self):
	try:
		resolv = open('/etc/resolv.conf')

def _get_network_infos(self, ifname):
	_ip = '0.0.0.0'
	_hwaddr = '00:00:00:00:00:00'
	_netmask = '0.0.0.0'
	_gateway = '0.0.0.0'
	ifconfig = os.popen('/sbin/ifconfig')
	raw = ifconfig.read()
	ifconfig.close()

def get_active_configuration(self):
	try:

active_ip = property((lambda self: self.get_active_configuration()['values']['ip']))
active_netmask = property((lambda self: self.get_active_configuration()['values']['netmask']))
active_gateway = property((lambda self: self.get_active_configuration()['values']['gateway']))
active_dns1 = property((lambda self: self.get_active_configuration()['values']['dns1']))
active_dns2 = property((lambda self: self.get_active_configuration()['values']['dns2']))
active_type = property((lambda self: self.get_active_configuration()['values']['type']))
active_hwaddr = property((lambda self: self._get_hwaddr()))
active_values = property((lambda self: self.get_active_configuration()['values']))
def get_configuration_by_name(self, name):
	try:
		return self.pynet.getConfiguration(name)
	except:
		log.error('Failed to get config: %s', name)
		PRINT_EXCEPTION()
		return None
	return None

def set_configuration(self, config, new_params):
	config = PYNET_DEVICE[config]
	try:
		old_params = self.get_configuration_by_name(config)
	except:
		PRINT_EXCEPTION()
	else:
		for k, v in new_params.iteritems():
			if k in PY_RANK_PARAMS:
				old_params[PY_RANK_PARAMS[k]] = v
				continue
		self.pynet.setConfiguration(config, *old_params[1:])

def set_value_config(self, config, where, val):
	ret = self.get_configuration_by_name(config)
	if ret is not None and self.pynet:
		ret[PY_RANK_PARAMS[where]] = val
		try:
			self.pynet.setConfiguration(config, *ret[1:])
		except:
			PRINT_EXCEPTION()

def set_values_config(self, config, mapping_val):
	config = PYNET_DEVICE[config]
	for k, v in mapping_val.iteritems():
		if k in PY_RANK_PARAMS:
			self.set_value_config(config, k, v)
			continue

def get_network_capabilities(self, ssid):
	auth, cypher, key_mgt = None, None, None
	net = self.get_net_by_name(ssid)
	if net is not None and self.pynet:
		net_path = net.object_path
		try:
			auth, cypher, key_mgt = self.pynet.getNetworkCapabilities(net_path)
		except:
			PRINT_EXCEPTION()

def connect_with_config(self, config):
	config = PYNET_DEVICE[config]
	ret = self.get_configuration_by_name(config)
	if ret is not None and self.pynet:
		try:
			self.pynet.setActiveConfiguration(config)
			log.debug('Set %s as active network configuration', config)
			return True
		except:
			PRINT_EXCEPTION()
			return False
	else:
		return False

def device_added(self, obj, name):
	log.debug('sig DeviceAdded(%s, %s)', obj, name)

def wireless_network_appeared(self, dev, net):
	log.debug('sig WirelessNetworkAppeared (%s) on (%s)', net, dev)

def wireless_network_disappeared(self, dev, net):
	log.debug('sig WirelessNetworkDisappeared (%s) on (%s)', net, dev)

def ethernet_now_active(self, dev):
	log.debug('sig DeviceNowActive (%s)', dev)

def wireless_now_active(self, dev, ssid):
	log.debug('sig DeviceNowActive (%s)', dev)

def device_no_longer_active(self, dev):
	log.debug('sig DeviceNoLongerActive (%s)', dev)

def device_activation_failed(self, dev, ssid):
	log.debug('sig DeviceActivationFailed (%s)', dev)

def get_devices(self):
	devs = call(self._getDevices)
	dev_list = []
	if devs:
		for dev in devs:
			dev_list.append(Device(self._wdb, dev))
	return dev_list

def _NetworkManager__activate_wlan(self, dev_path, essid):
	try:
		self._setActiveWlanDevice(dev_path, essid)
		return True
	except:
		return False

def _NetworkManager__activate_wep(self, dev_path, essid, cypher, key, auth_alg):
	try:
		self._setActiveWepDevice(dev_path, essid, NM_cyphers[cypher], key, IW_auth[auth_alg])
		return True
	except:
		return False

def _NetworkManager__activate_wpa(self, dev_path, essid, cypher, key, wpa_version, key_mgt):
	try:
		self._setActiveWpaDevice(dev_path, essid, NM_cyphers[cypher], key, IW_wpa_versions[wpa_version], IW_key_mgt[key_mgt])
		return True
	except:
		return False

def _NetworkManager__activate_eth(self, dev_path):
	try:
		self._setActiveEthDevice(dev_path)
		return True
	except:
		return False

def set_active_device(self, device, network=None, cypher=None, key=None, auth_alg=None, wpa_version=None, key_mgt=None):
	log.debug('active_device device=%s network=%s cypher=%s key=%s auth_alg=%s wpa_version=%s key_mgt=%s', device, network, cypher, key, auth_alg, wpa_version, key_mgt)
	if isinstance(device, str):
		device = self.get_dev_by_name(device)
	if isinstance(device, Device):
		if network:
			if isinstance(network, Network):
				pass
			essid = network
			if cypher is None or cypher == 'NM_AUTH_TYPE_NONE':
				return self._NetworkManager__activate_wlan(device.object_path, essid)
			else:
				if 'WEP' in cypher:
					return self._NetworkManager__activate_wep(device.object_path, essid, cypher, key, auth_alg)
				else:
					if 'WPA' in cypher:
						return self._NetworkManager__activate_wpa(device.object_path, essid, cypher, key, wpa_version, key_mgt)
		else:
			return self._NetworkManager__activate_eth(device.object_path)
	return False

def get_state(self):
	state = call(self._state)
	if state:
		return NM_state[state]
	return None

def get_all_networks(self):
	networks = []
	devs = self.get_devices()
	for dev in devs:
		if dev.get_type() == 'wireless':
			nets = dev.get_networks()
			for net in nets:
				networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
			else:
				continue
	return networks

def get_wire_device(self):
	for dev in self.get_devices():
		if dev.get_type() == 'ethernet':
			return dev
			continue

def show_networks(self):
	for net in self.get_all_networks():
		print '%s\t%s\t%s\t%s' % (net['strength'], net['encrypted'], net['device_obj'].get_name(), net['name'])

def get_dev_by_name(self, name):
	for dev in self.get_devices():
		if dev.get_name() == name:
			return dev
			continue

def get_net_by_name(self, essid):
	for net in self.get_all_networks():
		if net['name'] == essid:
			return net['network_obj']
			continue

def help(self):
	print 'NM.show_networks()\n'
	print 'ETH: NM.set_active_device(dev)'
	print 'OPE: NM.set_active_device(dev, net)'
	print 'WEP: NM.set_active_device(dev, net, cypher, key, auth_alg)'
	print 'WPA: NM.set_active_device(dev, net, cypher, key, wpa_version, key_mgt)\n'
	print 'dev: device object or device name (ra0)'
	print 'net: network object or essid (wifi-test)\n'
	print 'cyphers in:'
	print NM_cyphers.keys()
	print 'auth_alg in:'
	print IW_auth.keys()
	print 'wpa_version in:'
	print IW_wpa_versions.keys()
	print 'key_mgt in:'
	print IW_key_mgt.keys()
	print "\nEX: NM.set_active_device('eth1', 'wyplay-upnp', 'NM_AUTH_TYPE_WEP104', '852E2FB20D6756DC3DDF16CF9B', 'IW_AUTH_ALG_SHARED_KEY')"

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb764102c>}
nname: 0
n 0(None)[self._wdb = wdb
self.object_path = object_path
self._nm_device = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
self._getProperties = self._nm_device.method('getProperties', '', '(osusbusssssssiibiuusas)')
self._getName = self._nm_device.method('getName', '', 's')
self._getType = self._nm_device.method('getType', '', 'i')
self._getHalUdi = self._nm_device.method('getHalUdi', '', 's')
self._getIP4Address = self._nm_device.method('getIP4Address', '', 'u')
self._getLinkActive = self._nm_device.method('getLinkActive', '', 'b')
self._getActiveNetwork = self._nm_device.method('getActiveNetwork', '', 's')
self._getNetworks = self._nm_device.method('getNetworks', '', 'ao')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75df92c>}
nname: 0
n 0(None)[return call(self._getName)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764168c>}
nname: 31
n 31(None)[return None
]:
	i: 18(), 30()
	o: 

nname: 30
n 30(None)[]:
	i: 0(f)
	o: 31()

nname: 18
n 18(None)[return NM_devices_type[type]
]:
	i: 0(t)
	o: 31()

nname: 0
n 0(type)[type = self._getType()
]:
	i: 
	o: 18(t), 30(f)

nname: 0
n 0(None)[type = self._getType()
if type:
	return NM_devices_type[type]
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76417ec>}
nname: 0
n 0(None)[return call(self._getHalUdi)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76415ec>}
DFADecompile Exception need more than 0 values to unpack
nname: 68
n 68(None)[68]:
	i: 63(AE)
	o: 

nname: 63
n 63(None)[return ip
]:
	i: 0(finally), 59()
	o: 68(AE)

nname: 59
n 59(None)[]:
	i: 6(), 46(), 58(AE)
	o: 63()

nname: 46
n 46(None)[ip = None
]:
	i: 3(except)
	o: 59()

nname: 6
n 6(None)[ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
]:
	i: 3(try)
	o: 59()

nname: 3
n 3(None)[]:
	i: 0(ASF)
	o: 6(try), 46(except)

nname: 0
n 0(None)[]:
	i: 
	o: 3(ASF2), 63(finally)

nname: 68
n 68(None)[68]:
	i: 63(AE)
	o: 

nname: 63
n 63(None)[return ip
]:
	i: 0(finally), 46()
	o: 68(AE)

nname: 46
n 46(None)[except:
	ip = None
]:
	i: 3()
	o: 63()

nname: 3
n 3(None)[try:
	ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
]:
	i: 0(ASF2)
	o: 46()

nname: 0
n 0(None)[]:
	i: 
	o: 3(ASF2), 63(finally)

nname: 68
n 68(None)[68]:
	i: 63(AE)
	o: 

nname: 63
n 63(None)[return ip
]:
	i: 0(finally), 3()
	o: 68(AE)

nname: 3
n 3(None)[try:
	ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
except:
	ip = None
]:
	i: 0(ASF2)
	o: 63()

nname: 0
n 0(None)[]:
	i: 
	o: 3(ASF2), 63(finally)

nname: 63
n 63(None)[finally:
	return ip
68]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
except:
	ip = None
]:
	i: 
	o: 63()

nname: 0
n 0(None)[try:
	ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
except:
	ip = None
finally:
	return ip
68]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76419ec>}
nname: 0
n 0(None)[return call(self._getLinkActive)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764162c>}
nname: 36
n 36(None)[return None
]:
	i: 21(), 35()
	o: 

nname: 35
n 35(None)[]:
	i: 0(f)
	o: 36()

nname: 21
n 21(None)[return Network(net)
]:
	i: 0(t)
	o: 36()

nname: 0
n 0(net)[net = call(self._getActiveNetwork)
]:
	i: 
	o: 21(t), 35(f)

nname: 0
n 0(None)[net = call(self._getActiveNetwork)
if net:
	return Network(net)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76418ac>}
nname: 74
n 74(None)[return net_list
]:
	i: 27(AL), 69(), 73()
	o: 

nname: 73
n 73(None)[]:
	i: 0(f)
	o: 74()

nname: 69
n 69(None)[]:
	i: 31(AF), 38()
	o: 74()

nname: 38
n 38(None)[for net in nets:
net_list.append(Network(self._wdb, net))
]:
	i: 31(for)
	o: 69()

nname: 31
n 31(None)[]:
	i: 27(loop)
	o: 38(for), 69(AF)

nname: 27
n 27(None)[]:
	i: 0(t)
	o: 31(loop), 74(AL)

nname: 0
n 0(nets)[nets = call(self._getNetworks)
net_list = []
]:
	i: 
	o: 27(t), 73(f)

nname: 74
n 74(None)[return net_list
]:
	i: 38(), 0(f)
	o: 

nname: 38
n 38(None)[for net in nets:
	net_list.append(Network(self._wdb, net))
]:
	i: 27(for)
	o: 74()

nname: 27
n 27(None)[]:
	i: 0(t)
	o: 38(for)

nname: 0
n 0(nets)[nets = call(self._getNetworks)
net_list = []
]:
	i: 
	o: 27(t), 74(f)

nname: 74
n 74(None)[return net_list
]:
	i: 27(), 0(f)
	o: 

nname: 27
n 27(None)[for net in nets:
	net_list.append(Network(self._wdb, net))
]:
	i: 0(t)
	o: 74()

nname: 0
n 0(nets)[nets = call(self._getNetworks)
net_list = []
]:
	i: 
	o: 27(t), 74(f)

nname: 0
n 0(None)[nets = call(self._getNetworks)
net_list = []
if nets:
	for net in nets:
		net_list.append(Network(self._wdb, net))
return net_list
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76418ec>}
nname: 6
n 6(None)[def __init__(self, wdb, object_path):
	self._wdb = wdb
	self.object_path = object_path
	self._nm_device = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
	self._getProperties = self._nm_device.method('getProperties', '', '(osusbusssssssiibiuusas)')
	self._getName = self._nm_device.method('getName', '', 's')
	self._getType = self._nm_device.method('getType', '', 'i')
	self._getHalUdi = self._nm_device.method('getHalUdi', '', 's')
	self._getIP4Address = self._nm_device.method('getIP4Address', '', 'u')
	self._getLinkActive = self._nm_device.method('getLinkActive', '', 'b')
	self._getActiveNetwork = self._nm_device.method('getActiveNetwork', '', 's')
	self._getNetworks = self._nm_device.method('getNetworks', '', 'ao')

def get_name(self):
	return call(self._getName)

def get_type(self):
	type = self._getType()
	if type:
		return NM_devices_type[type]
	return None

def get_hal_udi(self):
	return call(self._getHalUdi)

def get_ip_address(self):
	try:
		ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
	except:
		ip = None
	finally:
		return ip
	68
def get_link_active(self):
	return call(self._getLinkActive)

def get_active_network(self):
	net = call(self._getActiveNetwork)
	if net:
		return Network(net)
	return None

def get_networks(self):
	nets = call(self._getNetworks)
	net_list = []
	if nets:
		for net in nets:
			net_list.append(Network(self._wdb, net))
	return net_list

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76414ac>}
nname: 0
n 0(None)[self._wdb = wdb
self.object_path = object_path
self._nm_network = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
self._getName = self._nm_network.method('getName', '', 's')
self._getAddress = self._nm_network.method('getAddress', '', 's')
self._getStrength = self._nm_network.method('getStrength', '', 'i')
self._getFrequency = self._nm_network.method('getFrequency', '', 'd')
self._getRate = self._nm_network.method('getRate', '', 'i')
self._getEncrypted = self._nm_network.method('getEncrypted', '', 'b')
self._getProperties = self._nm_network.method('getProperties', '', '(ossidiiib)')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75dfe6c>}
nname: 0
n 0(None)[return call(self._getName)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76411cc>}
nname: 0
n 0(None)[return call(self._getStrength)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76415ac>}
nname: 0
n 0(None)[return call(self._getFrequency)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764158c>}
nname: 0
n 0(None)[return call(self._getRate)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76411ec>}
nname: 0
n 0(None)[return call(self._getEncrypted)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76411cc>}
nname: 0
n 0(None)[return call(self._getProperties)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76415ac>}
nname: 6
n 6(None)[def __init__(self, wdb, object_path):
	self._wdb = wdb
	self.object_path = object_path
	self._nm_network = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
	self._getName = self._nm_network.method('getName', '', 's')
	self._getAddress = self._nm_network.method('getAddress', '', 's')
	self._getStrength = self._nm_network.method('getStrength', '', 'i')
	self._getFrequency = self._nm_network.method('getFrequency', '', 'd')
	self._getRate = self._nm_network.method('getRate', '', 'i')
	self._getEncrypted = self._nm_network.method('getEncrypted', '', 'b')
	self._getProperties = self._nm_network.method('getProperties', '', '(ossidiiib)')

def get_name(self):
	return call(self._getName)

def get_strength(self):
	return call(self._getStrength)

def get_frequency(self):
	return call(self._getFrequency)

def get_rate(self):
	return call(self._getRate)

def get_encrypted(self):
	return call(self._getEncrypted)

def get_properties(self):
	return call(self._getProperties)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75da42c>}
nname: 869
n 869(None)[]:
	i: 823(), 868()
	o: 

nname: 868
n 868(None)[]:
	i: 724(f)
	o: 869()

nname: 823
n 823(None)[NM.help()
import pdb
pdb.set_trace()
]:
	i: 724(t)
	o: 869()

nname: 724
n 724(__name__ == '__main__')[del _[1]
def hexdump(src, length=8):
	result = []

class NetworkManager(object):
	__doc__ = ' Main class to control networkmanager '
	__metaclass__ = MetaSingleton
	def __init__(self):
		from peewee.dbus import peewee_dbus
		self._pynet = None
		self._wdb = peewee_dbus
		self._nm = self._wdb.reference(dbus_service, '/org/freedesktop/NetworkManager', 'org.freedesktop.NetworkManager')
		self._nm_sig = self._wdb.instance('/org/freedesktop/NetworkManager')
		self._getDevices = self._nm.method('getDevices', '', 'ao')
		self._state = self._nm.method('state', '', 'i')
		self._setActiveEthDevice = self._nm.method('setActiveDevice', 'o', '')
		self._setActiveWlanDevice = self._nm.method('setActiveDevice', 'os', '')
		self._setActiveWepDevice = self._nm.method('setActiveDevice', 'osisi', '')
		self._setActiveWpaDevice = self._nm.method('setActiveDevice', 'osisii', '')
		self._obs = []
		self._nm_sig.signal('DeviceAdded', 'os', self.device_added, 0)
		self._nm_sig.signal('DeviceNowActive', 'os', self.wireless_now_active, 0)
		self._nm_sig.signal('DeviceActivationFailed', 'os', self.device_activation_failed, 0)
		self._nm_sig.signal('WirelessNetworkAppeared', 'oo', self.wireless_network_appeared, 0)
		self._nm_sig.signal('WirelessNetworkDisappeared', 'oo', self.wireless_network_disappeared, 0)
		self.get_wireless_configuration = partial(self.get_configuration_by_name, 'Wireless')
		self.get_wired_configuration = partial(self.get_configuration_by_name, 'Ethernet')
		return None

	def _get_pynet(self):
		if not self._pynet:
			try:
				self._pynet = pynetwork.WyNetworkModule_instance()
			except:
				log.warn('Unable to contect wynetwork')
				self._pynet = None

	pynet = property(_get_pynet)
	del _get_pynet
	def register_observer(self, obs):
		self._obs.append(obs)

	def unregister_observer(self, obj):
		self._obs.remove(obj)

	def _get_hwaddr(self):
		ifconfig = os.popen('/sbin/ifconfig')
		raw = ifconfig.read()
		ifconfig.close()
		interface = self.get_active_configuration()['values']['interface']
		if interface is None:
			return '00:00:00:00:00:00'

	def _get_dns_servers(self):
		try:
			resolv = open('/etc/resolv.conf')

	def _get_network_infos(self, ifname):
		_ip = '0.0.0.0'
		_hwaddr = '00:00:00:00:00:00'
		_netmask = '0.0.0.0'
		_gateway = '0.0.0.0'
		ifconfig = os.popen('/sbin/ifconfig')
		raw = ifconfig.read()
		ifconfig.close()

	def get_active_configuration(self):
		try:

	active_ip = property((lambda self: self.get_active_configuration()['values']['ip']))
	active_netmask = property((lambda self: self.get_active_configuration()['values']['netmask']))
	active_gateway = property((lambda self: self.get_active_configuration()['values']['gateway']))
	active_dns1 = property((lambda self: self.get_active_configuration()['values']['dns1']))
	active_dns2 = property((lambda self: self.get_active_configuration()['values']['dns2']))
	active_type = property((lambda self: self.get_active_configuration()['values']['type']))
	active_hwaddr = property((lambda self: self._get_hwaddr()))
	active_values = property((lambda self: self.get_active_configuration()['values']))
	def get_configuration_by_name(self, name):
		try:
			return self.pynet.getConfiguration(name)
		except:
			log.error('Failed to get config: %s', name)
			PRINT_EXCEPTION()
			return None
		return None

	def set_configuration(self, config, new_params):
		config = PYNET_DEVICE[config]
		try:
			old_params = self.get_configuration_by_name(config)
		except:
			PRINT_EXCEPTION()
		else:
			for k, v in new_params.iteritems():
				if k in PY_RANK_PARAMS:
					old_params[PY_RANK_PARAMS[k]] = v
					continue
			self.pynet.setConfiguration(config, *old_params[1:])

	def set_value_config(self, config, where, val):
		ret = self.get_configuration_by_name(config)
		if ret is not None and self.pynet:
			ret[PY_RANK_PARAMS[where]] = val
			try:
				self.pynet.setConfiguration(config, *ret[1:])
			except:
				PRINT_EXCEPTION()

	def set_values_config(self, config, mapping_val):
		config = PYNET_DEVICE[config]
		for k, v in mapping_val.iteritems():
			if k in PY_RANK_PARAMS:
				self.set_value_config(config, k, v)
				continue

	def get_network_capabilities(self, ssid):
		auth, cypher, key_mgt = None, None, None
		net = self.get_net_by_name(ssid)
		if net is not None and self.pynet:
			net_path = net.object_path
			try:
				auth, cypher, key_mgt = self.pynet.getNetworkCapabilities(net_path)
			except:
				PRINT_EXCEPTION()

	def connect_with_config(self, config):
		config = PYNET_DEVICE[config]
		ret = self.get_configuration_by_name(config)
		if ret is not None and self.pynet:
			try:
				self.pynet.setActiveConfiguration(config)
				log.debug('Set %s as active network configuration', config)
				return True
			except:
				PRINT_EXCEPTION()
				return False
		else:
			return False

	def device_added(self, obj, name):
		log.debug('sig DeviceAdded(%s, %s)', obj, name)

	def wireless_network_appeared(self, dev, net):
		log.debug('sig WirelessNetworkAppeared (%s) on (%s)', net, dev)

	def wireless_network_disappeared(self, dev, net):
		log.debug('sig WirelessNetworkDisappeared (%s) on (%s)', net, dev)

	def ethernet_now_active(self, dev):
		log.debug('sig DeviceNowActive (%s)', dev)

	def wireless_now_active(self, dev, ssid):
		log.debug('sig DeviceNowActive (%s)', dev)

	def device_no_longer_active(self, dev):
		log.debug('sig DeviceNoLongerActive (%s)', dev)

	def device_activation_failed(self, dev, ssid):
		log.debug('sig DeviceActivationFailed (%s)', dev)

	def get_devices(self):
		devs = call(self._getDevices)
		dev_list = []
		if devs:
			for dev in devs:
				dev_list.append(Device(self._wdb, dev))
		return dev_list

	def _NetworkManager__activate_wlan(self, dev_path, essid):
		try:
			self._setActiveWlanDevice(dev_path, essid)
			return True
		except:
			return False

	def _NetworkManager__activate_wep(self, dev_path, essid, cypher, key, auth_alg):
		try:
			self._setActiveWepDevice(dev_path, essid, NM_cyphers[cypher], key, IW_auth[auth_alg])
			return True
		except:
			return False

	def _NetworkManager__activate_wpa(self, dev_path, essid, cypher, key, wpa_version, key_mgt):
		try:
			self._setActiveWpaDevice(dev_path, essid, NM_cyphers[cypher], key, IW_wpa_versions[wpa_version], IW_key_mgt[key_mgt])
			return True
		except:
			return False

	def _NetworkManager__activate_eth(self, dev_path):
		try:
			self._setActiveEthDevice(dev_path)
			return True
		except:
			return False

	def set_active_device(self, device, network=None, cypher=None, key=None, auth_alg=None, wpa_version=None, key_mgt=None):
		log.debug('active_device device=%s network=%s cypher=%s key=%s auth_alg=%s wpa_version=%s key_mgt=%s', device, network, cypher, key, auth_alg, wpa_version, key_mgt)
		if isinstance(device, str):
			device = self.get_dev_by_name(device)
		if isinstance(device, Device):
			if network:
				if isinstance(network, Network):
					pass
				essid = network
				if cypher is None or cypher == 'NM_AUTH_TYPE_NONE':
					return self._NetworkManager__activate_wlan(device.object_path, essid)
				else:
					if 'WEP' in cypher:
						return self._NetworkManager__activate_wep(device.object_path, essid, cypher, key, auth_alg)
					else:
						if 'WPA' in cypher:
							return self._NetworkManager__activate_wpa(device.object_path, essid, cypher, key, wpa_version, key_mgt)
			else:
				return self._NetworkManager__activate_eth(device.object_path)
		return False

	def get_state(self):
		state = call(self._state)
		if state:
			return NM_state[state]
		return None

	def get_all_networks(self):
		networks = []
		devs = self.get_devices()
		for dev in devs:
			if dev.get_type() == 'wireless':
				nets = dev.get_networks()
				for net in nets:
					networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
				else:
					continue
		return networks

	def get_wire_device(self):
		for dev in self.get_devices():
			if dev.get_type() == 'ethernet':
				return dev
				continue

	def show_networks(self):
		for net in self.get_all_networks():
			print '%s\t%s\t%s\t%s' % (net['strength'], net['encrypted'], net['device_obj'].get_name(), net['name'])

	def get_dev_by_name(self, name):
		for dev in self.get_devices():
			if dev.get_name() == name:
				return dev
				continue

	def get_net_by_name(self, essid):
		for net in self.get_all_networks():
			if net['name'] == essid:
				return net['network_obj']
				continue

	def help(self):
		print 'NM.show_networks()\n'
		print 'ETH: NM.set_active_device(dev)'
		print 'OPE: NM.set_active_device(dev, net)'
		print 'WEP: NM.set_active_device(dev, net, cypher, key, auth_alg)'
		print 'WPA: NM.set_active_device(dev, net, cypher, key, wpa_version, key_mgt)\n'
		print 'dev: device object or device name (ra0)'
		print 'net: network object or essid (wifi-test)\n'
		print 'cyphers in:'
		print NM_cyphers.keys()
		print 'auth_alg in:'
		print IW_auth.keys()
		print 'wpa_version in:'
		print IW_wpa_versions.keys()
		print 'key_mgt in:'
		print IW_key_mgt.keys()
		print "\nEX: NM.set_active_device('eth1', 'wyplay-upnp', 'NM_AUTH_TYPE_WEP104', '852E2FB20D6756DC3DDF16CF9B', 'IW_AUTH_ALG_SHARED_KEY')"



class Device(object):
	def __init__(self, wdb, object_path):
		self._wdb = wdb
		self.object_path = object_path
		self._nm_device = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
		self._getProperties = self._nm_device.method('getProperties', '', '(osusbusssssssiibiuusas)')
		self._getName = self._nm_device.method('getName', '', 's')
		self._getType = self._nm_device.method('getType', '', 'i')
		self._getHalUdi = self._nm_device.method('getHalUdi', '', 's')
		self._getIP4Address = self._nm_device.method('getIP4Address', '', 'u')
		self._getLinkActive = self._nm_device.method('getLinkActive', '', 'b')
		self._getActiveNetwork = self._nm_device.method('getActiveNetwork', '', 's')
		self._getNetworks = self._nm_device.method('getNetworks', '', 'ao')

	def get_name(self):
		return call(self._getName)

	def get_type(self):
		type = self._getType()
		if type:
			return NM_devices_type[type]
		return None

	def get_hal_udi(self):
		return call(self._getHalUdi)

	def get_ip_address(self):
		try:
			ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
		except:
			ip = None
		finally:
			return ip
		68
	def get_link_active(self):
		return call(self._getLinkActive)

	def get_active_network(self):
		net = call(self._getActiveNetwork)
		if net:
			return Network(net)
		return None

	def get_networks(self):
		nets = call(self._getNetworks)
		net_list = []
		if nets:
			for net in nets:
				net_list.append(Network(self._wdb, net))
		return net_list



class Network(object):
	def __init__(self, wdb, object_path):
		self._wdb = wdb
		self.object_path = object_path
		self._nm_network = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
		self._getName = self._nm_network.method('getName', '', 's')
		self._getAddress = self._nm_network.method('getAddress', '', 's')
		self._getStrength = self._nm_network.method('getStrength', '', 'i')
		self._getFrequency = self._nm_network.method('getFrequency', '', 'd')
		self._getRate = self._nm_network.method('getRate', '', 'i')
		self._getEncrypted = self._nm_network.method('getEncrypted', '', 'b')
		self._getProperties = self._nm_network.method('getProperties', '', '(ossidiiib)')

	def get_name(self):
		return call(self._getName)

	def get_strength(self):
		return call(self._getStrength)

	def get_frequency(self):
		return call(self._getFrequency)

	def get_rate(self):
		return call(self._getRate)

	def get_encrypted(self):
		return call(self._getEncrypted)

	def get_properties(self):
		return call(self._getProperties)



]:
	i: 146(AF), 720()
	o: 823(t), 868(f)

nname: 720
n 720(None)[]:
	i: 667&703(t), 716()
	o: 724()

nname: 716
n 716(None)[]:
	i: 667&703(f)
	o: 720()

nname: 667&703
n 667&703(len(repr(chr(x))) == 3 and chr(x))[for x in range(256):
]:
	i: 146(for)
	o: 716(f), 720(t)

nname: 146
n 146(None)[from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.misc_utils import MetaSingleton
from peewee.notifier import Task
NM_devices_type = ['unknown', 'ethernet', 'wireless']
NM_state = ['unknown', 'asleep', 'connecting', 'connected', 'disconnected']
NM_device_state = ['unknown', 'down', 'disconnected', 'prepare', 'config', 'need_auth', 'ip_config', 'activated', 'failed', 'cancelled']
NM_cyphers = {'NM_AUTH_TYPE_WPA_PSK_AUTO': 0, 'NM_AUTH_TYPE_NONE': 1, 'NM_AUTH_TYPE_WEP40': 2, 'NM_AUTH_TYPE_WPA_PSK_TKIP': 4, 'NM_AUTH_TYPE_WPA_PSK_CCMP': 8, 'NM_AUTH_TYPE_WEP104': 16, 'NM_AUTH_TYPE_WPA_EAP': 32, 'NM_AUTH_TYPE_LEAP': 64}
IW_auth = {'IW_AUTH_ALG_OPEN_SYSTEM': 1, 'IW_AUTH_ALG_SHARED_KEY': 2, 'IW_AUTH_ALG_LEAP': 4}
IW_wpa_versions = {'IW_AUTH_WPA_VERSION_WPA': 2, 'IW_AUTH_WPA_VERSION_WPA2': 4}
IW_key_mgt = {'IW_AUTH_KEY_MGMT_802_1X': 1, 'IW_AUTH_KEY_MGMT_PSK': 2}
PYNET_DEVICE = {'802.3': 'Ethernet', 'Ethernet': '802.3', '802.11': 'Wireless', 'Wireless': '802.11', None: 'Disconnected', 'Disconnected': None}
PY_RANK_PARAMS = {'interface': 1, 'type': 2, 'mode': 3, 'ip': 4, 'netmask': 5, 'gateway': 6, 'dns1': 7, 'dns2': 8, 'network': 9, 'cypher': 10, 'auth': 11, 'key': 12, 'key_mgt': 13}
dbus_service = 'org.freedesktop.NetworkManager'
log = GET_LOGGER('network')
def call(m):
	try:
		ret = m()
	except Exception, e:
		log.error('dbus error while calling %s: %s', m, e)
		ret = None
	return ret

]:
	i: 101(), 131(), 144(AE)
	o: 667&703(for), 724(AF)

nname: 144
n 144(None)[]:
	i: 121(f)
	o: 146(AE)

nname: 131
n 131(None)[_[1], FILTER, NM, pynetwork = [], [](range(256)), NetworkManager(), None
]:
	i: 121(t)
	o: 146()

nname: 121
n 121(<dummy_ex3> EXC_MATCH ImportError)[]:
	i: 0(except)
	o: 131(t), 144(f)

nname: 101
n 101(None)[from wynetwork import pynetwork
]:
	i: 0(try)
	o: 146()

nname: 0
n 0(None)[from __future__ import absolute_import
import os
from socket import inet_ntoa, ntohl
from struct import pack
from functools import partial
from wydbus import WyDBus
]:
	i: 
	o: 101(try), 121(except)

nname: 724
n 724(None)[del _[1]
def hexdump(src, length=8):
	result = []

class NetworkManager(object):
	__doc__ = ' Main class to control networkmanager '
	__metaclass__ = MetaSingleton
	def __init__(self):
		from peewee.dbus import peewee_dbus
		self._pynet = None
		self._wdb = peewee_dbus
		self._nm = self._wdb.reference(dbus_service, '/org/freedesktop/NetworkManager', 'org.freedesktop.NetworkManager')
		self._nm_sig = self._wdb.instance('/org/freedesktop/NetworkManager')
		self._getDevices = self._nm.method('getDevices', '', 'ao')
		self._state = self._nm.method('state', '', 'i')
		self._setActiveEthDevice = self._nm.method('setActiveDevice', 'o', '')
		self._setActiveWlanDevice = self._nm.method('setActiveDevice', 'os', '')
		self._setActiveWepDevice = self._nm.method('setActiveDevice', 'osisi', '')
		self._setActiveWpaDevice = self._nm.method('setActiveDevice', 'osisii', '')
		self._obs = []
		self._nm_sig.signal('DeviceAdded', 'os', self.device_added, 0)
		self._nm_sig.signal('DeviceNowActive', 'os', self.wireless_now_active, 0)
		self._nm_sig.signal('DeviceActivationFailed', 'os', self.device_activation_failed, 0)
		self._nm_sig.signal('WirelessNetworkAppeared', 'oo', self.wireless_network_appeared, 0)
		self._nm_sig.signal('WirelessNetworkDisappeared', 'oo', self.wireless_network_disappeared, 0)
		self.get_wireless_configuration = partial(self.get_configuration_by_name, 'Wireless')
		self.get_wired_configuration = partial(self.get_configuration_by_name, 'Ethernet')
		return None

	def _get_pynet(self):
		if not self._pynet:
			try:
				self._pynet = pynetwork.WyNetworkModule_instance()
			except:
				log.warn('Unable to contect wynetwork')
				self._pynet = None

	pynet = property(_get_pynet)
	del _get_pynet
	def register_observer(self, obs):
		self._obs.append(obs)

	def unregister_observer(self, obj):
		self._obs.remove(obj)

	def _get_hwaddr(self):
		ifconfig = os.popen('/sbin/ifconfig')
		raw = ifconfig.read()
		ifconfig.close()
		interface = self.get_active_configuration()['values']['interface']
		if interface is None:
			return '00:00:00:00:00:00'

	def _get_dns_servers(self):
		try:
			resolv = open('/etc/resolv.conf')

	def _get_network_infos(self, ifname):
		_ip = '0.0.0.0'
		_hwaddr = '00:00:00:00:00:00'
		_netmask = '0.0.0.0'
		_gateway = '0.0.0.0'
		ifconfig = os.popen('/sbin/ifconfig')
		raw = ifconfig.read()
		ifconfig.close()

	def get_active_configuration(self):
		try:

	active_ip = property((lambda self: self.get_active_configuration()['values']['ip']))
	active_netmask = property((lambda self: self.get_active_configuration()['values']['netmask']))
	active_gateway = property((lambda self: self.get_active_configuration()['values']['gateway']))
	active_dns1 = property((lambda self: self.get_active_configuration()['values']['dns1']))
	active_dns2 = property((lambda self: self.get_active_configuration()['values']['dns2']))
	active_type = property((lambda self: self.get_active_configuration()['values']['type']))
	active_hwaddr = property((lambda self: self._get_hwaddr()))
	active_values = property((lambda self: self.get_active_configuration()['values']))
	def get_configuration_by_name(self, name):
		try:
			return self.pynet.getConfiguration(name)
		except:
			log.error('Failed to get config: %s', name)
			PRINT_EXCEPTION()
			return None
		return None

	def set_configuration(self, config, new_params):
		config = PYNET_DEVICE[config]
		try:
			old_params = self.get_configuration_by_name(config)
		except:
			PRINT_EXCEPTION()
		else:
			for k, v in new_params.iteritems():
				if k in PY_RANK_PARAMS:
					old_params[PY_RANK_PARAMS[k]] = v
					continue
			self.pynet.setConfiguration(config, *old_params[1:])

	def set_value_config(self, config, where, val):
		ret = self.get_configuration_by_name(config)
		if ret is not None and self.pynet:
			ret[PY_RANK_PARAMS[where]] = val
			try:
				self.pynet.setConfiguration(config, *ret[1:])
			except:
				PRINT_EXCEPTION()

	def set_values_config(self, config, mapping_val):
		config = PYNET_DEVICE[config]
		for k, v in mapping_val.iteritems():
			if k in PY_RANK_PARAMS:
				self.set_value_config(config, k, v)
				continue

	def get_network_capabilities(self, ssid):
		auth, cypher, key_mgt = None, None, None
		net = self.get_net_by_name(ssid)
		if net is not None and self.pynet:
			net_path = net.object_path
			try:
				auth, cypher, key_mgt = self.pynet.getNetworkCapabilities(net_path)
			except:
				PRINT_EXCEPTION()

	def connect_with_config(self, config):
		config = PYNET_DEVICE[config]
		ret = self.get_configuration_by_name(config)
		if ret is not None and self.pynet:
			try:
				self.pynet.setActiveConfiguration(config)
				log.debug('Set %s as active network configuration', config)
				return True
			except:
				PRINT_EXCEPTION()
				return False
		else:
			return False

	def device_added(self, obj, name):
		log.debug('sig DeviceAdded(%s, %s)', obj, name)

	def wireless_network_appeared(self, dev, net):
		log.debug('sig WirelessNetworkAppeared (%s) on (%s)', net, dev)

	def wireless_network_disappeared(self, dev, net):
		log.debug('sig WirelessNetworkDisappeared (%s) on (%s)', net, dev)

	def ethernet_now_active(self, dev):
		log.debug('sig DeviceNowActive (%s)', dev)

	def wireless_now_active(self, dev, ssid):
		log.debug('sig DeviceNowActive (%s)', dev)

	def device_no_longer_active(self, dev):
		log.debug('sig DeviceNoLongerActive (%s)', dev)

	def device_activation_failed(self, dev, ssid):
		log.debug('sig DeviceActivationFailed (%s)', dev)

	def get_devices(self):
		devs = call(self._getDevices)
		dev_list = []
		if devs:
			for dev in devs:
				dev_list.append(Device(self._wdb, dev))
		return dev_list

	def _NetworkManager__activate_wlan(self, dev_path, essid):
		try:
			self._setActiveWlanDevice(dev_path, essid)
			return True
		except:
			return False

	def _NetworkManager__activate_wep(self, dev_path, essid, cypher, key, auth_alg):
		try:
			self._setActiveWepDevice(dev_path, essid, NM_cyphers[cypher], key, IW_auth[auth_alg])
			return True
		except:
			return False

	def _NetworkManager__activate_wpa(self, dev_path, essid, cypher, key, wpa_version, key_mgt):
		try:
			self._setActiveWpaDevice(dev_path, essid, NM_cyphers[cypher], key, IW_wpa_versions[wpa_version], IW_key_mgt[key_mgt])
			return True
		except:
			return False

	def _NetworkManager__activate_eth(self, dev_path):
		try:
			self._setActiveEthDevice(dev_path)
			return True
		except:
			return False

	def set_active_device(self, device, network=None, cypher=None, key=None, auth_alg=None, wpa_version=None, key_mgt=None):
		log.debug('active_device device=%s network=%s cypher=%s key=%s auth_alg=%s wpa_version=%s key_mgt=%s', device, network, cypher, key, auth_alg, wpa_version, key_mgt)
		if isinstance(device, str):
			device = self.get_dev_by_name(device)
		if isinstance(device, Device):
			if network:
				if isinstance(network, Network):
					pass
				essid = network
				if cypher is None or cypher == 'NM_AUTH_TYPE_NONE':
					return self._NetworkManager__activate_wlan(device.object_path, essid)
				else:
					if 'WEP' in cypher:
						return self._NetworkManager__activate_wep(device.object_path, essid, cypher, key, auth_alg)
					else:
						if 'WPA' in cypher:
							return self._NetworkManager__activate_wpa(device.object_path, essid, cypher, key, wpa_version, key_mgt)
			else:
				return self._NetworkManager__activate_eth(device.object_path)
		return False

	def get_state(self):
		state = call(self._state)
		if state:
			return NM_state[state]
		return None

	def get_all_networks(self):
		networks = []
		devs = self.get_devices()
		for dev in devs:
			if dev.get_type() == 'wireless':
				nets = dev.get_networks()
				for net in nets:
					networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
				else:
					continue
		return networks

	def get_wire_device(self):
		for dev in self.get_devices():
			if dev.get_type() == 'ethernet':
				return dev
				continue

	def show_networks(self):
		for net in self.get_all_networks():
			print '%s\t%s\t%s\t%s' % (net['strength'], net['encrypted'], net['device_obj'].get_name(), net['name'])

	def get_dev_by_name(self, name):
		for dev in self.get_devices():
			if dev.get_name() == name:
				return dev
				continue

	def get_net_by_name(self, essid):
		for net in self.get_all_networks():
			if net['name'] == essid:
				return net['network_obj']
				continue

	def help(self):
		print 'NM.show_networks()\n'
		print 'ETH: NM.set_active_device(dev)'
		print 'OPE: NM.set_active_device(dev, net)'
		print 'WEP: NM.set_active_device(dev, net, cypher, key, auth_alg)'
		print 'WPA: NM.set_active_device(dev, net, cypher, key, wpa_version, key_mgt)\n'
		print 'dev: device object or device name (ra0)'
		print 'net: network object or essid (wifi-test)\n'
		print 'cyphers in:'
		print NM_cyphers.keys()
		print 'auth_alg in:'
		print IW_auth.keys()
		print 'wpa_version in:'
		print IW_wpa_versions.keys()
		print 'key_mgt in:'
		print IW_key_mgt.keys()
		print "\nEX: NM.set_active_device('eth1', 'wyplay-upnp', 'NM_AUTH_TYPE_WEP104', '852E2FB20D6756DC3DDF16CF9B', 'IW_AUTH_ALG_SHARED_KEY')"



class Device(object):
	def __init__(self, wdb, object_path):
		self._wdb = wdb
		self.object_path = object_path
		self._nm_device = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
		self._getProperties = self._nm_device.method('getProperties', '', '(osusbusssssssiibiuusas)')
		self._getName = self._nm_device.method('getName', '', 's')
		self._getType = self._nm_device.method('getType', '', 'i')
		self._getHalUdi = self._nm_device.method('getHalUdi', '', 's')
		self._getIP4Address = self._nm_device.method('getIP4Address', '', 'u')
		self._getLinkActive = self._nm_device.method('getLinkActive', '', 'b')
		self._getActiveNetwork = self._nm_device.method('getActiveNetwork', '', 's')
		self._getNetworks = self._nm_device.method('getNetworks', '', 'ao')

	def get_name(self):
		return call(self._getName)

	def get_type(self):
		type = self._getType()
		if type:
			return NM_devices_type[type]
		return None

	def get_hal_udi(self):
		return call(self._getHalUdi)

	def get_ip_address(self):
		try:
			ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
		except:
			ip = None
		finally:
			return ip
		68
	def get_link_active(self):
		return call(self._getLinkActive)

	def get_active_network(self):
		net = call(self._getActiveNetwork)
		if net:
			return Network(net)
		return None

	def get_networks(self):
		nets = call(self._getNetworks)
		net_list = []
		if nets:
			for net in nets:
				net_list.append(Network(self._wdb, net))
		return net_list



class Network(object):
	def __init__(self, wdb, object_path):
		self._wdb = wdb
		self.object_path = object_path
		self._nm_network = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
		self._getName = self._nm_network.method('getName', '', 's')
		self._getAddress = self._nm_network.method('getAddress', '', 's')
		self._getStrength = self._nm_network.method('getStrength', '', 'i')
		self._getFrequency = self._nm_network.method('getFrequency', '', 'd')
		self._getRate = self._nm_network.method('getRate', '', 'i')
		self._getEncrypted = self._nm_network.method('getEncrypted', '', 'b')
		self._getProperties = self._nm_network.method('getProperties', '', '(ossidiiib)')

	def get_name(self):
		return call(self._getName)

	def get_strength(self):
		return call(self._getStrength)

	def get_frequency(self):
		return call(self._getFrequency)

	def get_rate(self):
		return call(self._getRate)

	def get_encrypted(self):
		return call(self._getEncrypted)

	def get_properties(self):
		return call(self._getProperties)



if __name__ == '__main__':
	NM.help()
	import pdb
	pdb.set_trace()
]:
	i: 121(AF), 667&703(t)
	o: 

nname: 667&703
n 667&703(None)[for x in range(256):
if not(len(repr(chr(x))) == 3 and chr(x)):
	pass
]:
	i: 121(for)
	o: 724()

nname: 121
n 121(None)[except ImportError:
	_[1], FILTER, NM, pynetwork = [], [](range(256)), NetworkManager(), None
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.misc_utils import MetaSingleton
from peewee.notifier import Task
NM_devices_type = ['unknown', 'ethernet', 'wireless']
NM_state = ['unknown', 'asleep', 'connecting', 'connected', 'disconnected']
NM_device_state = ['unknown', 'down', 'disconnected', 'prepare', 'config', 'need_auth', 'ip_config', 'activated', 'failed', 'cancelled']
NM_cyphers = {'NM_AUTH_TYPE_WPA_PSK_AUTO': 0, 'NM_AUTH_TYPE_NONE': 1, 'NM_AUTH_TYPE_WEP40': 2, 'NM_AUTH_TYPE_WPA_PSK_TKIP': 4, 'NM_AUTH_TYPE_WPA_PSK_CCMP': 8, 'NM_AUTH_TYPE_WEP104': 16, 'NM_AUTH_TYPE_WPA_EAP': 32, 'NM_AUTH_TYPE_LEAP': 64}
IW_auth = {'IW_AUTH_ALG_OPEN_SYSTEM': 1, 'IW_AUTH_ALG_SHARED_KEY': 2, 'IW_AUTH_ALG_LEAP': 4}
IW_wpa_versions = {'IW_AUTH_WPA_VERSION_WPA': 2, 'IW_AUTH_WPA_VERSION_WPA2': 4}
IW_key_mgt = {'IW_AUTH_KEY_MGMT_802_1X': 1, 'IW_AUTH_KEY_MGMT_PSK': 2}
PYNET_DEVICE = {'802.3': 'Ethernet', 'Ethernet': '802.3', '802.11': 'Wireless', 'Wireless': '802.11', None: 'Disconnected', 'Disconnected': None}
PY_RANK_PARAMS = {'interface': 1, 'type': 2, 'mode': 3, 'ip': 4, 'netmask': 5, 'gateway': 6, 'dns1': 7, 'dns2': 8, 'network': 9, 'cypher': 10, 'auth': 11, 'key': 12, 'key_mgt': 13}
dbus_service = 'org.freedesktop.NetworkManager'
log = GET_LOGGER('network')
def call(m):
	try:
		ret = m()
	except Exception, e:
		log.error('dbus error while calling %s: %s', m, e)
		ret = None
	return ret

]:
	i: 0()
	o: 667&703(for), 724(AF)

nname: 0
n 0(None)[from __future__ import absolute_import
import os
from socket import inet_ntoa, ntohl
from struct import pack
from functools import partial
from wydbus import WyDBus
try:
	from wynetwork import pynetwork
]:
	i: 
	o: 121()

nname: 724
n 724(None)[del _[1]
def hexdump(src, length=8):
	result = []

class NetworkManager(object):
	__doc__ = ' Main class to control networkmanager '
	__metaclass__ = MetaSingleton
	def __init__(self):
		from peewee.dbus import peewee_dbus
		self._pynet = None
		self._wdb = peewee_dbus
		self._nm = self._wdb.reference(dbus_service, '/org/freedesktop/NetworkManager', 'org.freedesktop.NetworkManager')
		self._nm_sig = self._wdb.instance('/org/freedesktop/NetworkManager')
		self._getDevices = self._nm.method('getDevices', '', 'ao')
		self._state = self._nm.method('state', '', 'i')
		self._setActiveEthDevice = self._nm.method('setActiveDevice', 'o', '')
		self._setActiveWlanDevice = self._nm.method('setActiveDevice', 'os', '')
		self._setActiveWepDevice = self._nm.method('setActiveDevice', 'osisi', '')
		self._setActiveWpaDevice = self._nm.method('setActiveDevice', 'osisii', '')
		self._obs = []
		self._nm_sig.signal('DeviceAdded', 'os', self.device_added, 0)
		self._nm_sig.signal('DeviceNowActive', 'os', self.wireless_now_active, 0)
		self._nm_sig.signal('DeviceActivationFailed', 'os', self.device_activation_failed, 0)
		self._nm_sig.signal('WirelessNetworkAppeared', 'oo', self.wireless_network_appeared, 0)
		self._nm_sig.signal('WirelessNetworkDisappeared', 'oo', self.wireless_network_disappeared, 0)
		self.get_wireless_configuration = partial(self.get_configuration_by_name, 'Wireless')
		self.get_wired_configuration = partial(self.get_configuration_by_name, 'Ethernet')
		return None

	def _get_pynet(self):
		if not self._pynet:
			try:
				self._pynet = pynetwork.WyNetworkModule_instance()
			except:
				log.warn('Unable to contect wynetwork')
				self._pynet = None

	pynet = property(_get_pynet)
	del _get_pynet
	def register_observer(self, obs):
		self._obs.append(obs)

	def unregister_observer(self, obj):
		self._obs.remove(obj)

	def _get_hwaddr(self):
		ifconfig = os.popen('/sbin/ifconfig')
		raw = ifconfig.read()
		ifconfig.close()
		interface = self.get_active_configuration()['values']['interface']
		if interface is None:
			return '00:00:00:00:00:00'

	def _get_dns_servers(self):
		try:
			resolv = open('/etc/resolv.conf')

	def _get_network_infos(self, ifname):
		_ip = '0.0.0.0'
		_hwaddr = '00:00:00:00:00:00'
		_netmask = '0.0.0.0'
		_gateway = '0.0.0.0'
		ifconfig = os.popen('/sbin/ifconfig')
		raw = ifconfig.read()
		ifconfig.close()

	def get_active_configuration(self):
		try:

	active_ip = property((lambda self: self.get_active_configuration()['values']['ip']))
	active_netmask = property((lambda self: self.get_active_configuration()['values']['netmask']))
	active_gateway = property((lambda self: self.get_active_configuration()['values']['gateway']))
	active_dns1 = property((lambda self: self.get_active_configuration()['values']['dns1']))
	active_dns2 = property((lambda self: self.get_active_configuration()['values']['dns2']))
	active_type = property((lambda self: self.get_active_configuration()['values']['type']))
	active_hwaddr = property((lambda self: self._get_hwaddr()))
	active_values = property((lambda self: self.get_active_configuration()['values']))
	def get_configuration_by_name(self, name):
		try:
			return self.pynet.getConfiguration(name)
		except:
			log.error('Failed to get config: %s', name)
			PRINT_EXCEPTION()
			return None
		return None

	def set_configuration(self, config, new_params):
		config = PYNET_DEVICE[config]
		try:
			old_params = self.get_configuration_by_name(config)
		except:
			PRINT_EXCEPTION()
		else:
			for k, v in new_params.iteritems():
				if k in PY_RANK_PARAMS:
					old_params[PY_RANK_PARAMS[k]] = v
					continue
			self.pynet.setConfiguration(config, *old_params[1:])

	def set_value_config(self, config, where, val):
		ret = self.get_configuration_by_name(config)
		if ret is not None and self.pynet:
			ret[PY_RANK_PARAMS[where]] = val
			try:
				self.pynet.setConfiguration(config, *ret[1:])
			except:
				PRINT_EXCEPTION()

	def set_values_config(self, config, mapping_val):
		config = PYNET_DEVICE[config]
		for k, v in mapping_val.iteritems():
			if k in PY_RANK_PARAMS:
				self.set_value_config(config, k, v)
				continue

	def get_network_capabilities(self, ssid):
		auth, cypher, key_mgt = None, None, None
		net = self.get_net_by_name(ssid)
		if net is not None and self.pynet:
			net_path = net.object_path
			try:
				auth, cypher, key_mgt = self.pynet.getNetworkCapabilities(net_path)
			except:
				PRINT_EXCEPTION()

	def connect_with_config(self, config):
		config = PYNET_DEVICE[config]
		ret = self.get_configuration_by_name(config)
		if ret is not None and self.pynet:
			try:
				self.pynet.setActiveConfiguration(config)
				log.debug('Set %s as active network configuration', config)
				return True
			except:
				PRINT_EXCEPTION()
				return False
		else:
			return False

	def device_added(self, obj, name):
		log.debug('sig DeviceAdded(%s, %s)', obj, name)

	def wireless_network_appeared(self, dev, net):
		log.debug('sig WirelessNetworkAppeared (%s) on (%s)', net, dev)

	def wireless_network_disappeared(self, dev, net):
		log.debug('sig WirelessNetworkDisappeared (%s) on (%s)', net, dev)

	def ethernet_now_active(self, dev):
		log.debug('sig DeviceNowActive (%s)', dev)

	def wireless_now_active(self, dev, ssid):
		log.debug('sig DeviceNowActive (%s)', dev)

	def device_no_longer_active(self, dev):
		log.debug('sig DeviceNoLongerActive (%s)', dev)

	def device_activation_failed(self, dev, ssid):
		log.debug('sig DeviceActivationFailed (%s)', dev)

	def get_devices(self):
		devs = call(self._getDevices)
		dev_list = []
		if devs:
			for dev in devs:
				dev_list.append(Device(self._wdb, dev))
		return dev_list

	def _NetworkManager__activate_wlan(self, dev_path, essid):
		try:
			self._setActiveWlanDevice(dev_path, essid)
			return True
		except:
			return False

	def _NetworkManager__activate_wep(self, dev_path, essid, cypher, key, auth_alg):
		try:
			self._setActiveWepDevice(dev_path, essid, NM_cyphers[cypher], key, IW_auth[auth_alg])
			return True
		except:
			return False

	def _NetworkManager__activate_wpa(self, dev_path, essid, cypher, key, wpa_version, key_mgt):
		try:
			self._setActiveWpaDevice(dev_path, essid, NM_cyphers[cypher], key, IW_wpa_versions[wpa_version], IW_key_mgt[key_mgt])
			return True
		except:
			return False

	def _NetworkManager__activate_eth(self, dev_path):
		try:
			self._setActiveEthDevice(dev_path)
			return True
		except:
			return False

	def set_active_device(self, device, network=None, cypher=None, key=None, auth_alg=None, wpa_version=None, key_mgt=None):
		log.debug('active_device device=%s network=%s cypher=%s key=%s auth_alg=%s wpa_version=%s key_mgt=%s', device, network, cypher, key, auth_alg, wpa_version, key_mgt)
		if isinstance(device, str):
			device = self.get_dev_by_name(device)
		if isinstance(device, Device):
			if network:
				if isinstance(network, Network):
					pass
				essid = network
				if cypher is None or cypher == 'NM_AUTH_TYPE_NONE':
					return self._NetworkManager__activate_wlan(device.object_path, essid)
				else:
					if 'WEP' in cypher:
						return self._NetworkManager__activate_wep(device.object_path, essid, cypher, key, auth_alg)
					else:
						if 'WPA' in cypher:
							return self._NetworkManager__activate_wpa(device.object_path, essid, cypher, key, wpa_version, key_mgt)
			else:
				return self._NetworkManager__activate_eth(device.object_path)
		return False

	def get_state(self):
		state = call(self._state)
		if state:
			return NM_state[state]
		return None

	def get_all_networks(self):
		networks = []
		devs = self.get_devices()
		for dev in devs:
			if dev.get_type() == 'wireless':
				nets = dev.get_networks()
				for net in nets:
					networks.append({'name': net.get_name(), 'strength': net.get_strength(), 'rate': net.get_rate(), 'encrypted': net.get_encrypted(), 'frequency': net.get_frequency(), 'device_obj': dev, 'network_obj': net})
				else:
					continue
		return networks

	def get_wire_device(self):
		for dev in self.get_devices():
			if dev.get_type() == 'ethernet':
				return dev
				continue

	def show_networks(self):
		for net in self.get_all_networks():
			print '%s\t%s\t%s\t%s' % (net['strength'], net['encrypted'], net['device_obj'].get_name(), net['name'])

	def get_dev_by_name(self, name):
		for dev in self.get_devices():
			if dev.get_name() == name:
				return dev
				continue

	def get_net_by_name(self, essid):
		for net in self.get_all_networks():
			if net['name'] == essid:
				return net['network_obj']
				continue

	def help(self):
		print 'NM.show_networks()\n'
		print 'ETH: NM.set_active_device(dev)'
		print 'OPE: NM.set_active_device(dev, net)'
		print 'WEP: NM.set_active_device(dev, net, cypher, key, auth_alg)'
		print 'WPA: NM.set_active_device(dev, net, cypher, key, wpa_version, key_mgt)\n'
		print 'dev: device object or device name (ra0)'
		print 'net: network object or essid (wifi-test)\n'
		print 'cyphers in:'
		print NM_cyphers.keys()
		print 'auth_alg in:'
		print IW_auth.keys()
		print 'wpa_version in:'
		print IW_wpa_versions.keys()
		print 'key_mgt in:'
		print IW_key_mgt.keys()
		print "\nEX: NM.set_active_device('eth1', 'wyplay-upnp', 'NM_AUTH_TYPE_WEP104', '852E2FB20D6756DC3DDF16CF9B', 'IW_AUTH_ALG_SHARED_KEY')"



class Device(object):
	def __init__(self, wdb, object_path):
		self._wdb = wdb
		self.object_path = object_path
		self._nm_device = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
		self._getProperties = self._nm_device.method('getProperties', '', '(osusbusssssssiibiuusas)')
		self._getName = self._nm_device.method('getName', '', 's')
		self._getType = self._nm_device.method('getType', '', 'i')
		self._getHalUdi = self._nm_device.method('getHalUdi', '', 's')
		self._getIP4Address = self._nm_device.method('getIP4Address', '', 'u')
		self._getLinkActive = self._nm_device.method('getLinkActive', '', 'b')
		self._getActiveNetwork = self._nm_device.method('getActiveNetwork', '', 's')
		self._getNetworks = self._nm_device.method('getNetworks', '', 'ao')

	def get_name(self):
		return call(self._getName)

	def get_type(self):
		type = self._getType()
		if type:
			return NM_devices_type[type]
		return None

	def get_hal_udi(self):
		return call(self._getHalUdi)

	def get_ip_address(self):
		try:
			ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address))))
		except:
			ip = None
		finally:
			return ip
		68
	def get_link_active(self):
		return call(self._getLinkActive)

	def get_active_network(self):
		net = call(self._getActiveNetwork)
		if net:
			return Network(net)
		return None

	def get_networks(self):
		nets = call(self._getNetworks)
		net_list = []
		if nets:
			for net in nets:
				net_list.append(Network(self._wdb, net))
		return net_list



class Network(object):
	def __init__(self, wdb, object_path):
		self._wdb = wdb
		self.object_path = object_path
		self._nm_network = self._wdb.reference(dbus_service, object_path, 'org.freedesktop.NetworkManager.Devices')
		self._getName = self._nm_network.method('getName', '', 's')
		self._getAddress = self._nm_network.method('getAddress', '', 's')
		self._getStrength = self._nm_network.method('getStrength', '', 'i')
		self._getFrequency = self._nm_network.method('getFrequency', '', 'd')
		self._getRate = self._nm_network.method('getRate', '', 'i')
		self._getEncrypted = self._nm_network.method('getEncrypted', '', 'b')
		self._getProperties = self._nm_network.method('getProperties', '', '(ossidiiib)')

	def get_name(self):
		return call(self._getName)

	def get_strength(self):
		return call(self._getStrength)

	def get_frequency(self):
		return call(self._getFrequency)

	def get_rate(self):
		return call(self._getRate)

	def get_encrypted(self):
		return call(self._getEncrypted)

	def get_properties(self):
		return call(self._getProperties)



if __name__ == '__main__':
	NM.help()
	import pdb
	pdb.set_trace()
]:
	i: 0(AF), 667&703(t)
	o: 

nname: 667&703
n 667&703(None)[for x in range(256):
if not(len(repr(chr(x))) == 3 and chr(x)):
	pass
]:
	i: 0(for)
	o: 724()

nname: 0
n 0(None)[from __future__ import absolute_import
import os
from socket import inet_ntoa, ntohl
from struct import pack
from functools import partial
from wydbus import WyDBus
try:
	from wynetwork import pynetwork
except ImportError:
	_[1], FILTER, NM, pynetwork = [], [](range(256)), NetworkManager(), None
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.misc_utils import MetaSingleton
from peewee.notifier import Task
NM_devices_type = ['unknown', 'ethernet', 'wireless']
NM_state = ['unknown', 'asleep', 'connecting', 'connected', 'disconnected']
NM_device_state = ['unknown', 'down', 'disconnected', 'prepare', 'config', 'need_auth', 'ip_config', 'activated', 'failed', 'cancelled']
NM_cyphers = {'NM_AUTH_TYPE_WPA_PSK_AUTO': 0, 'NM_AUTH_TYPE_NONE': 1, 'NM_AUTH_TYPE_WEP40': 2, 'NM_AUTH_TYPE_WPA_PSK_TKIP': 4, 'NM_AUTH_TYPE_WPA_PSK_CCMP': 8, 'NM_AUTH_TYPE_WEP104': 16, 'NM_AUTH_TYPE_WPA_EAP': 32, 'NM_AUTH_TYPE_LEAP': 64}
IW_auth = {'IW_AUTH_ALG_OPEN_SYSTEM': 1, 'IW_AUTH_ALG_SHARED_KEY': 2, 'IW_AUTH_ALG_LEAP': 4}
IW_wpa_versions = {'IW_AUTH_WPA_VERSION_WPA': 2, 'IW_AUTH_WPA_VERSION_WPA2': 4}
IW_key_mgt = {'IW_AUTH_KEY_MGMT_802_1X': 1, 'IW_AUTH_KEY_MGMT_PSK': 2}
PYNET_DEVICE = {'802.3': 'Ethernet', 'Ethernet': '802.3', '802.11': 'Wireless', 'Wireless': '802.11', None: 'Disconnected', 'Disconnected': None}
PY_RANK_PARAMS = {'interface': 1, 'type': 2, 'mode': 3, 'ip': 4, 'netmask': 5, 'gateway': 6, 'dns1': 7, 'dns2': 8, 'network': 9, 'cypher': 10, 'auth': 11, 'key': 12, 'key_mgt': 13}
dbus_service = 'org.freedesktop.NetworkManager'
log = GET_LOGGER('network')
def call(m):
	try:
		ret = m()
	except Exception, e:
		log.error('dbus error while calling %s: %s', m, e)
		ret = None
	return ret

]:
	i: 
	o: 667&703(for), 724(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb75da04c>, 724: <unpyclib.structure.node instance at 0xb75da1ac>, '667&703': <unpyclib.structure.node instance at 0xb75daacc>}
from __future__ import absolute_import
import os
from socket import inet_ntoa, ntohl
from struct import pack
from functools import partial
from wydbus import WyDBus
try:
	from wynetwork import pynetwork
except ImportError:
	_[1], FILTER, NM, pynetwork = [], [](range(256)), NetworkManager(), None
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.misc_utils import MetaSingleton
from peewee.notifier import Task
NM_devices_type = ['unknown', 'ethernet', 'wireless']
NM_state = ['unknown', 'asleep', 'connecting', 'connected', 'disconnected']
NM_device_state = ['unknown', 'down', 'disconnected', 'prepare', 'config', 'need_auth', 'ip_config', 'activated', 'failed', 'cancelled']
NM_cyphers = {'NM_AUTH_TYPE_WPA_PSK_AUTO': 0, 'NM_AUTH_TYPE_NONE': 1, 'NM_AUTH_TYPE_WEP40': 2, 'NM_AUTH_TYPE_WPA_PSK_TKIP': 4, 'NM_AUTH_TYPE_WPA_PSK_CCMP': 8, 'NM_AUTH_TYPE_WEP104': 16, 'NM_AUTH_TYPE_WPA_EAP': 32, 'NM_AUTH_TYPE_LEAP': 64}
IW_auth = {'IW_AUTH_ALG_OPEN_SYSTEM': 1, 'IW_AUTH_ALG_SHARED_KEY': 2, 'IW_AUTH_ALG_LEAP': 4}
IW_wpa_versions = {'IW_AUTH_WPA_VERSION_WPA': 2, 'IW_AUTH_WPA_VERSION_WPA2': 4}
IW_key_mgt = {'IW_AUTH_KEY_MGMT_802_1X': 1, 'IW_AUTH_KEY_MGMT_PSK': 2}
PYNET_DEVICE = {'802.3': 'Ethernet', 'Ethernet': '802.3', '802.11': 'Wireless', 'Wireless': '802.11', None: 'Disconnected', 'Disconnected': None}
PY_RANK_PARAMS = {'interface': 1, 'type': 2, 'mode': 3, 'ip': 4, 'netmask': 5, 'gateway': 6, 'dns1': 7, 'dns2': 8, 'network': 9, 'cypher': 10, 'auth': 11, 'key': 12, 'key_mgt': 13}
dbus_service = 'org.freedesktop.NetworkManager'
log = GET_LOGGER('network')
def call(m):
	try:
		ret = m()
	except Exception, e:
		log.error('dbus error while calling %s: %s', m, e)
		ret = None
	return ret

